[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 04/08: Return NULL for MHD_CONNECTION_INFO_CLIENT_ADDRES
From: |
gnunet |
Subject: |
[libmicrohttpd] 04/08: Return NULL for MHD_CONNECTION_INFO_CLIENT_ADDRESS if information is not available |
Date: |
Sat, 14 May 2022 15:11:39 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 57f3e09813b2af5a1e7cdd63ce83d968e17d7352
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sat May 14 15:20:53 2022 +0300
Return NULL for MHD_CONNECTION_INFO_CLIENT_ADDRESS if information is not
available
Pipe or UNIX socket connections may have no client address
---
src/microhttpd/connection.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index ab659064..949e6ec4 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -5041,12 +5041,16 @@ MHD_get_connection_info (struct MHD_Connection
*connection,
return &connection->connection_info_dummy;
#endif /* HTTPS_SUPPORT */
case MHD_CONNECTION_INFO_CLIENT_ADDRESS:
- memset (&connection->connection_info_dummy.client_addr, 0,
- sizeof (connection->connection_info_dummy.client_addr));
- memcpy (&connection->connection_info_dummy.client_addr,
- &connection->addr,
- connection->addr_len);
- return &connection->connection_info_dummy;
+ if (0 < connection->addr_len)
+ {
+ memset (&connection->connection_info_dummy.client_addr, 0,
+ sizeof (connection->connection_info_dummy.client_addr));
+ memcpy (&connection->connection_info_dummy.client_addr,
+ &connection->addr,
+ (size_t) connection->addr_len);
+ return &connection->connection_info_dummy;
+ }
+ return NULL;
case MHD_CONNECTION_INFO_DAEMON:
connection->connection_info_dummy.daemon = connection->daemon;
return &connection->connection_info_dummy;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (f50b6be7 -> 83fe7b77), gnunet, 2022/05/14
- [libmicrohttpd] 02/08: MHD_create_response_from_buffer_copy(): fixed doxy, gnunet, 2022/05/14
- [libmicrohttpd] 04/08: Return NULL for MHD_CONNECTION_INFO_CLIENT_ADDRESS if information is not available,
gnunet <=
- [libmicrohttpd] 01/08: Replaced MHD_RESPMEM_MUST_FREE with more portable solution in examples, gnunet, 2022/05/14
- [libmicrohttpd] 03/08: Replaced MHD_RESPMEM_PERSISTENT usage in examples and code, gnunet, 2022/05/14
- [libmicrohttpd] 08/08: Fixed additional compiler warnings on W32, gnunet, 2022/05/14
- [libmicrohttpd] 05/08: Fixed return type for get_system_fdsetsize_value (), gnunet, 2022/05/14
- [libmicrohttpd] 06/08: Fixed handling of connections with non-standard client addresses (pipe or UNIX sockets)., gnunet, 2022/05/14
- [libmicrohttpd] 07/08: Fixed some compiler warnings on W32, gnunet, 2022/05/14