[or-cvs] Use strlcpy, not strcpy.

Nick Mathewson nickm at seul.org
Wed Oct 27 06:48:18 UTC 2004


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv7044/src/common

Modified Files:
	util.c 
Log Message:
Use strlcpy, not strcpy.

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- util.c	27 Oct 2004 06:37:34 -0000	1.156
+++ util.c	27 Oct 2004 06:48:16 -0000	1.157
@@ -1847,13 +1847,12 @@
 #ifdef HAVE_UNAME
     if (uname(&u) != -1) {
       /* (linux says 0 is success, solaris says 1 is success) */
-      tor_snprintf(uname_result, 255, "%s %s %s",
+      tor_snprintf(uname_result, sizeof(uname_result), "%s %s %s",
                u.sysname, u.nodename, u.machine);
-      uname_result[255] = '\0';
     } else
 #endif
       {
-        strcpy(uname_result, "Unknown platform");
+        strlcpy(uname_result, "Unknown platform", sizeof(uname_result));
       }
     uname_result_is_set = 1;
   }



More information about the tor-commits mailing list