Fix invalid read in HttpParamDecode().

This commit is contained in:
Jordan Bancino 2023-01-09 15:48:56 +00:00
parent 9358264add
commit 1d9ed5dcbf

View file

@ -561,7 +561,7 @@ HttpServerWorkerThread(void *args)
} }
requestPath[i] = '\0'; requestPath[i] = '\0';
requestParams = HttpParamDecode(requestPath + i + 1); requestParams = (i == requestPathLen) ? NULL : HttpParamDecode(requestPath + i + 1);
context = HttpServerContextCreate(requestMethod, requestPath, requestParams, fp); context = HttpServerContextCreate(requestMethod, requestPath, requestParams, fp);
if (!context) if (!context)
@ -591,7 +591,7 @@ HttpServerWorkerThread(void *args)
line[i] = tolower(line[i]); line[i] = tolower(line[i]);
} }
headerKey = Malloc((i * sizeof(char)) + 1); headerKey = Malloc((i + 1) * sizeof(char));
if (!headerKey) if (!headerKey)
{ {
goto internal_error; goto internal_error;