gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated (bfa7c5a1 -> cd4d2f65)


From: gnunet
Subject: [libmicrohttpd] branch master updated (bfa7c5a1 -> cd4d2f65)
Date: Fri, 17 Nov 2023 05:53:38 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from bfa7c5a1 MHD_start_daemon(): fixed leaked listen socket when daemon 
start failed
     new 050c641b MHD_add_connection(): added more checks for correct members 
of sockaddr
     new cd4d2f65 MHD_add_connection(): minor readability improvement

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/daemon.c | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 5cca4797..e88600c2 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3599,6 +3599,19 @@ MHD_add_connection (struct MHD_Daemon *daemon,
 #endif /* HAVE_MESSAGES */
         return MHD_NO;
       }
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+      if ((0 != addr->sa_len) &&
+          (sizeof(struct sockaddr_in) > (size_t) addr->sa_len) )
+      {
+#ifdef HAVE_MESSAGES
+        MHD_DLOG (daemon,
+                  _ ("MHD_add_connection() has been called with " \
+                     "non-zero value of 'sa_len' member of " \
+                     "'struct sockaddr' which does not match 'sa_family'.\n"));
+#endif /* HAVE_MESSAGES */
+        return MHD_NO;
+      }
+#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
     }
 #ifdef HAVE_INET6
     if (AF_INET6 == addr->sa_family)
@@ -3612,7 +3625,25 @@ MHD_add_connection (struct MHD_Daemon *daemon,
 #endif /* HAVE_MESSAGES */
         return MHD_NO;
       }
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+      if ((0 != addr->sa_len) &&
+          (sizeof(struct sockaddr_in6) > (size_t) addr->sa_len) )
+      {
+#ifdef HAVE_MESSAGES
+        MHD_DLOG (daemon,
+                  _ ("MHD_add_connection() has been called with " \
+                     "non-zero value of 'sa_len' member of " \
+                     "'struct sockaddr' which does not match 'sa_family'.\n"));
+#endif /* HAVE_MESSAGES */
+        return MHD_NO;
+      }
+#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
     }
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+    if ((0 != addr->sa_len) &&
+        (addrlen > addr->sa_len))
+      addrlen = (socklen_t) addr->sa_len;   /* Use safest value */
+#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
 #endif /* HAVE_INET6 */
   }
 
@@ -3634,7 +3665,9 @@ MHD_add_connection (struct MHD_Daemon *daemon,
   sk_spipe_supprs = true; /* Nothing to suppress on W32 */
 #endif /* MHD_WINSOCK_SOCKETS */
 #if defined(MHD_socket_nosignal_)
-  if (! sk_spipe_supprs && ! MHD_socket_nosignal_ (client_socket))
+  if (! sk_spipe_supprs)
+    sk_spipe_supprs = MHD_socket_nosignal_ (client_socket);
+  if (! sk_spipe_supprs)
   {
 #ifdef HAVE_MESSAGES
     MHD_DLOG (daemon,
@@ -3655,8 +3688,6 @@ MHD_add_connection (struct MHD_Daemon *daemon,
     }
 #endif /* MSG_NOSIGNAL */
   }
-  else
-    sk_spipe_supprs = true;
 #endif /* MHD_socket_nosignal_ */
 
   if ( (0 != (daemon->options & MHD_USE_TURBO)) &&

-- 
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]