summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-01-15 22:08:14 +0100
committerBerke Viktor <berkeviktor@aol.com>2012-01-15 22:08:14 +0100
commit6d8d9c335d7d76df6d7209d55aa83c3daa4d4a05 (patch)
tree8c1c128b027019c0fe2fb7f51778a5928606fd7d
parenta8e3164fefdd2c48316b760c245764bf410d8cfd (diff)
avoid garbage in xchat_pluginpref_list
-rw-r--r--src/common/plugin.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c
index d4f7edc0..b37c59e2 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -1795,7 +1795,7 @@ xchat_pluginpref_list (xchat_plugin *pl, char* dest)
 {
 	FILE *fpIn;
 	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 *token;
 
@@ -1806,12 +1806,13 @@ xchat_pluginpref_list (xchat_plugin *pl, char* dest)
 
 	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;
 	}
-	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 */
 		{
 			token = strtok (buffer, "=");