[gateway,http] add a '\0' terminator to body read
ensure that every string read by the http functions is '\0' terminated.
This commit is contained in:
parent
13648c84af
commit
ab111b07bc
@ -1229,6 +1229,7 @@ HttpResponse* http_response_recv(rdpTls* tls, BOOL readContentLength)
|
||||
goto out_error;
|
||||
|
||||
response->BodyLength = Stream_GetPosition(response->data) - payloadOffset;
|
||||
|
||||
WINPR_ASSERT(response->BodyLength == 0);
|
||||
bodyLength = response->BodyLength; /* expected body length */
|
||||
|
||||
@ -1353,6 +1354,11 @@ HttpResponse* http_response_recv(rdpTls* tls, BOOL readContentLength)
|
||||
}
|
||||
Stream_SealLength(response->data);
|
||||
|
||||
/* Ensure '\0' terminated string */
|
||||
if (!Stream_EnsureRemainingCapacity(response->data, 2))
|
||||
goto out_error;
|
||||
Stream_Write_UINT16(response->data, 0);
|
||||
|
||||
return response;
|
||||
out_error:
|
||||
http_response_free(response);
|
||||
|
Loading…
Reference in New Issue
Block a user