Added size check for unix path configs
authorMatthias Wachs <wachs@net.in.tum.de>
Fri, 19 Nov 2010 16:11:58 +0000 (16:11 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Fri, 19 Nov 2010 16:11:58 +0000 (16:11 +0000)
src/util/service.c

index 3423b58cb56d717d4f4d52e586a621238a161c79..79b21e065fb0f9883974010ba6367ef83c0c7f1b 100644 (file)
@@ -867,6 +867,14 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
                                                            &unixpath));
 
       /* probe UNIX support */
+      struct sockaddr_un s_un;
+      if (strlen(unixpath) >= sizeof(s_un.sun_path))
+      {
+         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  _("UNIXPATH `%s' too long, maximum length is %llu\n"),unixpath, sizeof(s_un.sun_path));
+      }
+      /* FIXME: Perhaps add an assertion or a break??? */
+
       desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
       if (NULL == desc)
         {