1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Don't delete everything under a string-subkeyed primary key by using a

loop that fetches the next item using conf_get_str_strs and passing
the previous key as a parameter, because the previous key will have
been freed by the intervening conf_del_str_str. Instead, use the
technique of repeatedly using conf_get_str_nthstrkey with index 0 and
deleting what comes back, as PSCP and PSFTP do.

Spotted by Minefield with the aid of Jacob, or possibly vice versa.

[originally from svn r9220]
This commit is contained in:
Simon Tatham 2011-07-15 18:30:47 +00:00
parent 31fd55edf1
commit a474a598b5

View File

@ -145,9 +145,7 @@ static int gppmap(void *handle, char *name, Conf *conf, int primary)
/* /*
* Start by clearing any existing subkeys of this key from conf. * Start by clearing any existing subkeys of this key from conf.
*/ */
for (val = conf_get_str_strs(conf, primary, NULL, &key); while ((key = conf_get_str_nthstrkey(conf, primary, 0)) != NULL)
val != NULL;
val = conf_get_str_strs(conf, primary, key, &key))
conf_del_str_str(conf, primary, key); conf_del_str_str(conf, primary, key);
/* /*