Coverity fixes
authorNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 30 Sep 2011 23:17:38 +0000 (19:17 -0400)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 30 Sep 2011 23:17:38 +0000 (19:17 -0400)
* src/sysdep.c (init_system_name): use strncpy instead of strcpy
* src/sysdep.h: add start/stop async timeout prototypes.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/sysdep.c
src/sysdep.h

index c806b5a..fa74c2d 100644 (file)
@@ -2128,11 +2128,10 @@ void init_system_name(void)
                        hints.ai_socktype = SOCK_STREAM;
                        hints.ai_protocol = 0;
                        if (!getaddrinfo(hostname, NULL, &hints, &res)) {
-                               hostname =
-                                   (char *)alloca(strlen(res->ai_canonname) +
-                                                  1);
-                               strcpy(hostname, res->ai_canonname);
+                               ssize_t canon_len=strlen(res->ai_canonname)+1;
 
+                               hostname = (char *)alloca(canon_len);
+                               strncpy(hostname, res->ai_canonname, canon_len);
                                freeaddrinfo(res);
                        }
 #  endif                       /* !(HAVE_GETADDRINFO && HAVE_GETNAMEINFO) */
index 17fbfa0..65d70c4 100644 (file)
@@ -71,6 +71,8 @@ void unrequest_sigio(void);
 
 void stop_interrupts(void);
 void start_interrupts(void);
+void stop_async_timeouts(void);
+void start_async_timeouts(void);
 void slow_down_interrupts(void);
 void speed_up_interrupts(void);
 void init_poll_for_quit(void);