Mercurial > pidgin
diff libpurple/prefs.c @ 26885:8290e36a5a73
A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
increase the size of some buffers to be able to fit -2^63.
I don't think the snprintf() -> g_snprintf() changes do anything with glibc,
but there's no harm in using the glib function to guarantee NUL termination.
Fixes #8974
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sat, 16 May 2009 19:58:40 +0000 |
parents | 3687049b4faf |
children | 32a707746454 |
line wrap: on
line diff
--- a/libpurple/prefs.c Sat May 16 19:06:53 2009 +0000 +++ b/libpurple/prefs.c Sat May 16 19:58:40 2009 +0000 @@ -118,7 +118,7 @@ { xmlnode *node, *childnode; struct purple_pref *child; - char buf[20]; + char buf[21]; GList *cur; /* Create a new node */ @@ -128,7 +128,7 @@ /* Set the type of this node (if type == PURPLE_PREF_NONE then do nothing) */ if (pref->type == PURPLE_PREF_INT) { xmlnode_set_attrib(node, "type", "int"); - snprintf(buf, sizeof(buf), "%d", pref->value.integer); + g_snprintf(buf, sizeof(buf), "%d", pref->value.integer); xmlnode_set_attrib(node, "value", buf); } else if (pref->type == PURPLE_PREF_STRING) { @@ -161,7 +161,7 @@ } else if (pref->type == PURPLE_PREF_BOOLEAN) { xmlnode_set_attrib(node, "type", "bool"); - snprintf(buf, sizeof(buf), "%d", pref->value.boolean); + g_snprintf(buf, sizeof(buf), "%d", pref->value.boolean); xmlnode_set_attrib(node, "value", buf); }