Fix unsafe string handling in configs

Also fixes 2 leaks
This commit is contained in:
TingPing
2014-12-10 09:32:16 -05:00
parent 025152ee53
commit 10246f121a
2 changed files with 21 additions and 19 deletions

View File

@@ -960,10 +960,10 @@ servlist_savegui (void)
if (!rfc_casecmp (nick1, nick2))
return 2;
strcpy (prefs.hex_irc_nick1, nick1);
strcpy (prefs.hex_irc_nick2, nick2);
strcpy (prefs.hex_irc_nick3, gtk_entry_get_text (GTK_ENTRY (entry_nick3)));
strcpy (prefs.hex_irc_user_name, gtk_entry_get_text (GTK_ENTRY (entry_guser)));
safe_strcpy (prefs.hex_irc_nick1, nick1, sizeof(prefs.hex_irc_nick1));
safe_strcpy (prefs.hex_irc_nick2, nick2, sizeof(prefs.hex_irc_nick2));
safe_strcpy (prefs.hex_irc_nick3, gtk_entry_get_text (GTK_ENTRY (entry_nick3)), sizeof(prefs.hex_irc_nick3));
safe_strcpy (prefs.hex_irc_user_name, gtk_entry_get_text (GTK_ENTRY (entry_guser)), sizeof(prefs.hex_irc_user_name));
sp = strchr (prefs.hex_irc_user_name, ' ');
if (sp)
sp[0] = 0; /* spaces will break the login */