mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-09 13:42:09 -05:00
Merge r9276 (the PuTTYtel session-saving assertion failure fix).
[originally from svn r9277] [r9276 == 9da44eeb266f7c261e2f2c5787a2cb1407e55218]
This commit is contained in:
parent
7b068ab4ce
commit
2a6054ad7d
@ -303,11 +303,11 @@ static void wprefs(void *sesskey, char *name,
|
||||
for (maxlen = i = 0; i < nvals; i++) {
|
||||
const char *s = val2key(mapping, nvals, array[i]);
|
||||
if (s) {
|
||||
maxlen += 1 + strlen(s);
|
||||
maxlen += (maxlen > 0 ? 1 : 0) + strlen(s);
|
||||
}
|
||||
}
|
||||
|
||||
buf = snewn(maxlen, char);
|
||||
buf = snewn(maxlen + 1, char);
|
||||
p = buf;
|
||||
|
||||
for (i = 0; i < nvals; i++) {
|
||||
@ -317,7 +317,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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user