[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 03/04: MHD_add_connection(): reject wrong addrlen
From: |
gnunet |
Subject: |
[libmicrohttpd] 03/04: MHD_add_connection(): reject wrong addrlen |
Date: |
Mon, 31 Jan 2022 13:49:03 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 0e4fc12c5aa299ba89a917c2f6962d2a7e580255
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Jan 31 15:44:43 2022 +0300
MHD_add_connection(): reject wrong addrlen
---
src/microhttpd/daemon.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index e58a1caa..905844c7 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3429,6 +3429,35 @@ MHD_add_connection (struct MHD_Daemon *daemon,
" added sockets.\n"));
}
#endif /* HAVE_MESSAGES */
+ if (0 != addrlen)
+ {
+ if (AF_INET == addr->sa_family)
+ {
+ if (sizeof(struct sockaddr_in) > addrlen)
+ {
+#ifdef HAVE_MESSAGES
+ MHD_DLOG (daemon,
+ _ ("MHD_add_connection() has been called with "
+ "incorrect 'addrlen' value.\n"));
+#endif /* HAVE_MESSAGES */
+ return MHD_NO;
+ }
+ }
+#ifdef HAVE_INET6
+ if (AF_INET6 == addr->sa_family)
+ {
+ if (sizeof(struct sockaddr_in6) > addrlen)
+ {
+#ifdef HAVE_MESSAGES
+ MHD_DLOG (daemon,
+ _ ("MHD_add_connection() has been called with "
+ "incorrect 'addrlen' value.\n"));
+#endif /* HAVE_MESSAGES */
+ return MHD_NO;
+ }
+ }
+#endif /* HAVE_INET6 */
+ }
if (! MHD_socket_nonblocking_ (client_socket))
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.