gnunet-svn
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]