Mercurial > pidgin
diff libpurple/plugins/tcl/tcl_ref.c @ 31772:d5a00aa868f3
Fix up several Tcl loader string copies to use g_strlcpy().
Thanks to the Electronic Frontier Foundation (https://www.eff.org/)
for the foundation of this patch.
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Sun, 17 Jul 2011 17:34:55 +0000 |
parents | a8cc50c2279f |
children |
line wrap: on
line diff
--- 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); }