X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/259d04287fa6df1a1bc44c1f371c8dde2216ebda..e49c58ed3ff2ad33b26ddcf36246e23fa7260563:/config.c 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';