1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-26 11:12:19 -05:00

avoid garbage in xchat_pluginpref_list

This commit is contained in:
Berke Viktor 2012-01-15 22:08:14 +01:00
parent a8e3164fef
commit 6d8d9c335d

View File

@ -1795,7 +1795,7 @@ xchat_pluginpref_list (xchat_plugin *pl, char* dest)
{ {
FILE *fpIn; FILE *fpIn;
char confname[64]; char confname[64];
char buffer[512]; /* the same as in cfg_put_str */ char buffer[512]; /* the same as in cfg_put_str */
char buffer2[512]; char buffer2[512];
char *token; char *token;
@ -1806,12 +1806,13 @@ xchat_pluginpref_list (xchat_plugin *pl, char* dest)
fpIn = xchat_fopen_file (confname, "r", 0); fpIn = xchat_fopen_file (confname, "r", 0);
if (fpIn == NULL) /* no existing config file, no parsing */ if (fpIn == NULL) /* no existing config file, no parsing */
{ {
return 0; return 0;
} }
else /* existing config file, get list of settings */ else /* existing config file, get list of settings */
{ {
strcpy (dest, ""); /* clean up garbage */
while (fscanf (fpIn, " %[^\n]", &buffer) != EOF) /* read whole lines including whitespaces */ while (fscanf (fpIn, " %[^\n]", &buffer) != EOF) /* read whole lines including whitespaces */
{ {
token = strtok (buffer, "="); token = strtok (buffer, "=");