summaryrefslogtreecommitdiff
path: root/libpurple/account.c
diff options
context:
space:
mode:
authorRichard Laager <rlaager@pidgin.im>2009-05-16 19:58:40 +0000
committerRichard Laager <rlaager@pidgin.im>2009-05-16 19:58:40 +0000
commit48783375ea32df2b423cb976cc30575ee09d9229 (patch)
treeac6df45d8c78b835f83d7afcba9d8612165e9f3b /libpurple/account.c
parent3ca1b0b71fa43096dec39e364f744227f42a9570 (diff)
downloadpidgin-48783375ea32df2b423cb976cc30575ee09d9229.tar.gz
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
Diffstat (limited to 'libpurple/account.c')
-rw-r--r--libpurple/account.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libpurple/account.c b/libpurple/account.c
index c38c4c84e4..f0a33b6db4 100644
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -99,7 +99,7 @@ setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
const char *name;
PurpleAccountSetting *setting;
xmlnode *node, *child;
- char buf[20];
+ char buf[21];
name = (const char *)key;
setting = (PurpleAccountSetting *)value;
@@ -110,7 +110,7 @@ setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
if (setting->type == PURPLE_PREF_INT) {
xmlnode_set_attrib(child, "type", "int");
- snprintf(buf, sizeof(buf), "%d", setting->value.integer);
+ g_snprintf(buf, sizeof(buf), "%d", setting->value.integer);
xmlnode_insert_data(child, buf, -1);
}
else if (setting->type == PURPLE_PREF_STRING && setting->value.string != NULL) {
@@ -119,7 +119,7 @@ setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
}
else if (setting->type == PURPLE_PREF_BOOLEAN) {
xmlnode_set_attrib(child, "type", "bool");
- snprintf(buf, sizeof(buf), "%d", setting->value.boolean);
+ g_snprintf(buf, sizeof(buf), "%d", setting->value.boolean);
xmlnode_insert_data(child, buf, -1);
}
}
@@ -281,7 +281,7 @@ proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info)
PurpleProxyType proxy_type;
const char *value;
int int_value;
- char buf[20];
+ char buf[21];
proxy_type = purple_proxy_info_get_type(proxy_info);
@@ -304,7 +304,7 @@ proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info)
if ((int_value = purple_proxy_info_get_port(proxy_info)) != 0)
{
- snprintf(buf, sizeof(buf), "%d", int_value);
+ g_snprintf(buf, sizeof(buf), "%d", int_value);
child = xmlnode_new_child(node, "port");
xmlnode_insert_data(child, buf, -1);
}
@@ -342,7 +342,7 @@ current_error_to_xmlnode(PurpleConnectionErrorInfo *err)
return node;
child = xmlnode_new_child(node, "type");
- snprintf(type_str, sizeof(type_str), "%u", err->type);
+ g_snprintf(type_str, sizeof(type_str), "%u", err->type);
xmlnode_insert_data(child, type_str, -1);
child = xmlnode_new_child(node, "description");