Fix two off-by-one memory assignments

These bugs were found with ZeroPath.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
pull/770/head
Joshua Rogers 2025-10-24 00:21:06 +08:00
parent 23e18c9132
commit c88b7c66c6
1 changed files with 2 additions and 2 deletions

View File

@ -966,7 +966,7 @@ GenericPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
/* send username */
template = "username \"Auth\" \"%s\"";
char *username = escape_string(param->user);
fmt = malloc(strlen(template) + strlen(username));
fmt = malloc(strlen(template) + strlen(username) + 1);
if (fmt && username)
{
@ -2188,7 +2188,7 @@ OnNeedOk(connection_t *c, char *msg)
}
/* allocate space for response : "needok param->id cancel/ok" */
resp = malloc(strlen(param->id) + strlen("needok \' \' cancel"));
resp = malloc(strlen(param->id) + strlen("needok \' \' cancel") + 1);
wstr = Widen(param->str);
if (!wstr || !resp)