Fix crash in hexchat_pluginpref_list()

Set max output size to 4096
This commit is contained in:
TingPing 2013-09-30 01:23:20 -04:00
parent 76b1c2f1ed
commit b7e8f64bba
2 changed files with 3 additions and 3 deletions

View File

@ -1959,7 +1959,7 @@ Module_hexchat_pluginpref_list(PyObject *self, PyObject *args)
{ {
PluginObject *plugin = (PluginObject*)Plugin_GetCurrent(); PluginObject *plugin = (PluginObject*)Plugin_GetCurrent();
hexchat_plugin *prefph = Plugin_GetHandle(plugin); hexchat_plugin *prefph = Plugin_GetHandle(plugin);
char list[512]; char list[4096];
char* token; char* token;
int result; int result;
PyObject *pylist; PyObject *pylist;

View File

@ -2015,8 +2015,8 @@ hexchat_pluginpref_list (hexchat_plugin *pl, char* dest)
while (fscanf (fpIn, " %[^\n]", bufp) != EOF) /* read whole lines including whitespaces */ while (fscanf (fpIn, " %[^\n]", bufp) != EOF) /* read whole lines including whitespaces */
{ {
token = strtok (buffer, "="); token = strtok (buffer, "=");
strncat (dest, token, strlen (token) - 1); g_strlcat (dest, token, 4096); /* Dest must not be smaller than this */
strcat (dest, ","); g_strlcat (dest, ",", 4096);
} }
fclose (fpIn); fclose (fpIn);