X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=config.c;h=60724cefd1b3663144696cee90acad15352bde1c;hb=8316deb3399fe1d0c406132cf2e795a76de26b64;hp=1501f6191a4872ab309307ac2a36da81921a26d9;hpb=0598df92173fece3b32cdf7bd857556454b741bd;p=PuTTY.git diff --git a/config.c b/config.c index 1501f619..60724cef 100644 --- a/config.c +++ b/config.c @@ -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';