libpurple/plugins/tcl/tcl_ref.c

changeset 31956
f2b6b7f5631b
parent 31294
73607ab89c6f
child 34304
faf0414a8b51
--- a/libpurple/plugins/tcl/tcl_ref.c	Sun Jul 17 17:17:19 2011 +0000
+++ b/libpurple/plugins/tcl/tcl_ref.c	Sun Jul 17 17:34:55 2011 +0000
@@ -92,6 +92,7 @@
 
 static void purple_tcl_ref_update(Tcl_Obj *obj)
 {
+	size_t len;
 	/* This is ugly on memory, but we pretty much have to either
 	 * do this or guesstimate lengths or introduce a varargs
 	 * function in here ... ugh. */
@@ -100,8 +101,9 @@
 				      OBJ_REF_VALUE(obj));
 
 	obj->length = strlen(bytes);
-	obj->bytes = ckalloc(obj->length + 1);
-	strcpy(obj->bytes, bytes);
+	len = obj->length + 1;
+	obj->bytes = ckalloc(len);
+	g_strlcpy(obj->bytes, bytes, len);
 	g_free(bytes);
 }
 

mercurial