diff libpurple/protocols/zephyr/Zinternal.c @ 32228:5d442ea707b5

Replace numerous strcpy() invocations with strlcpy() in Zephyr. Thanks to the Electronic Frontier Foundation (http://www.eff.org/) for this patch.
author Ethan Blanton <elb@pidgin.im>
date Sun, 17 Jul 2011 03:57:21 +0000
parents 28b328da7269
children e972e2161bf5
line wrap: on
line diff
--- a/libpurple/protocols/zephyr/Zinternal.c	Sun Jul 17 03:56:39 2011 +0000
+++ b/libpurple/protocols/zephyr/Zinternal.c	Sun Jul 17 03:57:21 2011 +0000
@@ -677,7 +677,7 @@
     if (buffer_len < strlen(notice->z_version)+1)
 	return (ZERR_HEADERLEN);
 
-    (void) strcpy(ptr, notice->z_version);
+    g_strlcpy(ptr, notice->z_version, buffer_len);
     ptr += strlen(ptr)+1;
 
     if (ZMakeAscii32(ptr, end-ptr, Z_NUMFIELDS + notice->z_num_other_fields)
@@ -767,9 +767,9 @@
     if (*ptr+len > end)
 	return 1;
     if (field)
-	(void) strcpy(*ptr, field);
+      g_strlcpy(*ptr, field, len);
     else
-	**ptr = '\0';
+      **ptr = '\0';
     *ptr += len;
 
     return 0;