[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11815 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11815 - gnunet/src/util |
Date: |
Fri, 18 Jun 2010 18:54:44 +0200 |
Author: grothoff
Date: 2010-06-18 18:54:44 +0200 (Fri, 18 Jun 2010)
New Revision: 11815
Modified:
gnunet/src/util/common_logging.c
Log:
check len
Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c 2010-06-18 16:35:28 UTC (rev 11814)
+++ gnunet/src/util/common_logging.c 2010-06-18 16:54:44 UTC (rev 11815)
@@ -524,6 +524,8 @@
switch (addr->sa_family)
{
case AF_INET:
+ if (addrlen != sizeof (struct sockaddr_in))
+ return "<invalid v4 address>";
v4 = (const struct sockaddr_in *) addr;
inet_ntop (AF_INET, &v4->sin_addr, buf, INET_ADDRSTRLEN);
if (0 == ntohs (v4->sin_port))
@@ -533,6 +535,8 @@
strcat (buf, b2);
return buf;
case AF_INET6:
+ if (addrlen != sizeof (struct sockaddr_in6))
+ return "<invalid v4 address>";
v6 = (const struct sockaddr_in6 *) addr;
buf[0] = '[';
inet_ntop (AF_INET6, &v6->sin6_addr, &buf[1], INET6_ADDRSTRLEN);
@@ -543,6 +547,8 @@
strcat (buf, b2);
return buf;
case AF_UNIX:
+ if (addrlen <= sizeof (sa_family_t))
+ return "<invalid UNIX address>";
un = (const struct sockaddr_un*) addr;
off = 0;
if (un->sun_path[0] == '\0') off++;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11815 - gnunet/src/util,
gnunet <=