mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Fix assertion failure in wprefs() when the list is zero-length. Breaks
any session-save operation in PuTTYtel due to the empty GSS list. [originally from svn r9276]
This commit is contained in:
parent
8e4df14ee7
commit
9da44eeb26
@ -382,11 +382,11 @@ static void wprefs(void *sesskey, char *name,
|
|||||||
const char *s = val2key(mapping, nvals,
|
const char *s = val2key(mapping, nvals,
|
||||||
conf_get_int_int(conf, primary, i));
|
conf_get_int_int(conf, primary, i));
|
||||||
if (s) {
|
if (s) {
|
||||||
maxlen += 1 + strlen(s);
|
maxlen += (maxlen > 0 ? 1 : 0) + strlen(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = snewn(maxlen, char);
|
buf = snewn(maxlen + 1, char);
|
||||||
p = buf;
|
p = buf;
|
||||||
|
|
||||||
for (i = 0; i < nvals; i++) {
|
for (i = 0; i < nvals; i++) {
|
||||||
@ -397,7 +397,8 @@ static void wprefs(void *sesskey, char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(p - buf == maxlen - 1); /* maxlen counted the NUL */
|
assert(p - buf == maxlen);
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
write_setting_s(sesskey, name, buf);
|
write_setting_s(sesskey, name, buf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user