[core,rdstls] ensure stream length on empy return

This commit is contained in:
akallabeth
2023-03-08 08:29:34 +01:00
committed by akallabeth
parent 7c24da917e
commit f5a8da4f62

View File

@@ -138,6 +138,9 @@ static SSIZE_T rdstls_write_string(wStream* s, const char* str)
{
/* Write unicode null */
Stream_Write_UINT16(s, 2);
if (!Stream_EnsureRemainingCapacity(s, 2))
return -1;
Stream_Write_UINT16(s, 0);
return (SSIZE_T)(Stream_GetPosition(s) - pos);
}
@@ -162,8 +165,12 @@ static BOOL rdstls_write_data(wStream* s, UINT32 length, const BYTE* data)
if (!data)
{
return -1;
/* Write unicode null */
Stream_Write_UINT16(s, 2);
if (!Stream_EnsureRemainingCapacity(s, 2))
return -1;
Stream_Write_UINT16(s, 0);
return TRUE;
}