mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-02-04 06: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:
parent
16c3026b28
commit
cd16a955b5
4
config.c
4
config.c
@ -726,7 +726,7 @@ static void portfwd_handler(union control *ctrl, void *dlg,
|
|||||||
if (type != 'D') {
|
if (type != 'D') {
|
||||||
*p++ = '\t';
|
*p++ = '\t';
|
||||||
dlg_editbox_get(pfd->destbox, dlg, p,
|
dlg_editbox_get(pfd->destbox, dlg, p,
|
||||||
sizeof(str)-1 - (p - str));
|
sizeof(str) - (p - str));
|
||||||
if (!*p || !strchr(p, ':')) {
|
if (!*p || !strchr(p, ':')) {
|
||||||
dlg_error_msg(dlg,
|
dlg_error_msg(dlg,
|
||||||
"You need to specify a destination address\n"
|
"You need to specify a destination address\n"
|
||||||
@ -741,7 +741,7 @@ static void portfwd_handler(union control *ctrl, void *dlg,
|
|||||||
p++;
|
p++;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
if ((p - cfg->portfwd) + strlen(str) + 2 <
|
if ((p - cfg->portfwd) + strlen(str) + 2 <=
|
||||||
sizeof(cfg->portfwd)) {
|
sizeof(cfg->portfwd)) {
|
||||||
strcpy(p, str);
|
strcpy(p, str);
|
||||||
p[strlen(str) + 1] = '\0';
|
p[strlen(str) + 1] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user