larsiusprime / SteamWrap

Haxe native extension for the Steam API
MIT License
106 stars 44 forks source link

SteamWrap_FileRead buffer overflow #15

Open maaniv opened 7 years ago

maaniv commented 7 years ago

Function SteamWrap_FileRead code do not put zero to end of string char bytesData = (char )malloc(length); int32 result = SteamRemoteStorage()->FileRead(fName, bytesData, length);

value returnValue = alloc_string(bytesData);

Must be char bytesData = (char )malloc(length + 1); int32 result = SteamRemoteStorage()->FileRead(fName, bytesData, length); *(bytesData + length) = 0;

value returnValue = alloc_string(bytesData);
larsiusprime commented 7 years ago

I believe using alloc_string_len might fix this: https://github.com/larsiusprime/SteamWrap/issues/10

I'm working on a patch.