1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Fix minor imprecisions in cfg->portfwd[] bounds checking (which erred on the

side of rejecting input, not buffer overflow).

[originally from svn r5438]
This commit is contained in:
Jacob Nevins 2005-03-04 01:02:53 +00:00
parent 16c3026b28
commit cd16a955b5

View File

@ -726,7 +726,7 @@ static void portfwd_handler(union control *ctrl, void *dlg,
if (type != 'D') {
*p++ = '\t';
dlg_editbox_get(pfd->destbox, dlg, p,
sizeof(str)-1 - (p - str));
sizeof(str) - (p - str));
if (!*p || !strchr(p, ':')) {
dlg_error_msg(dlg,
"You need to specify a destination address\n"
@ -741,7 +741,7 @@ static void portfwd_handler(union control *ctrl, void *dlg,
p++;
p++;
}
if ((p - cfg->portfwd) + strlen(str) + 2 <
if ((p - cfg->portfwd) + strlen(str) + 2 <=
sizeof(cfg->portfwd)) {
strcpy(p, str);
p[strlen(str) + 1] = '\0';