From b7e8f64bbaea4b78e8a744ca94082528c3eda4dd Mon Sep 17 00:00:00 2001 From: TingPing Date: Mon, 30 Sep 2013 01:23:20 -0400 Subject: [PATCH] Fix crash in hexchat_pluginpref_list() Set max output size to 4096 --- plugins/python/python.c | 2 +- src/common/plugin.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/python/python.c b/plugins/python/python.c index 9ef7e0ed..0103eccf 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -1959,7 +1959,7 @@ Module_hexchat_pluginpref_list(PyObject *self, PyObject *args) { PluginObject *plugin = (PluginObject*)Plugin_GetCurrent(); hexchat_plugin *prefph = Plugin_GetHandle(plugin); - char list[512]; + char list[4096]; char* token; int result; PyObject *pylist; diff --git a/src/common/plugin.c b/src/common/plugin.c index d186679a..117e2d33 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -2015,8 +2015,8 @@ hexchat_pluginpref_list (hexchat_plugin *pl, char* dest) while (fscanf (fpIn, " %[^\n]", bufp) != EOF) /* read whole lines including whitespaces */ { token = strtok (buffer, "="); - strncat (dest, token, strlen (token) - 1); - strcat (dest, ","); + g_strlcat (dest, token, 4096); /* Dest must not be smaller than this */ + g_strlcat (dest, ",", 4096); } fclose (fpIn);