mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -04:00
Fix memory corruption crash when there are entries with large leading whitespace in options.txt etc (Thanks TrueDJSlimeball)
This commit is contained in:
parent
6cc0b5d80f
commit
3027439a8b
@ -241,9 +241,10 @@ cc_result EntryList_Load(struct StringsBuffer* list, const char* file, char sepa
|
|||||||
|
|
||||||
/* ReadLine reads single byte at a time */
|
/* ReadLine reads single byte at a time */
|
||||||
Stream_ReadonlyBuffered(&buffered, &stream, buffer, sizeof(buffer));
|
Stream_ReadonlyBuffered(&buffered, &stream, buffer, sizeof(buffer));
|
||||||
String_InitArray(entry, entryBuffer);
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
/* Must be re-initialised each time as String_UNSAFE_TrimStart adjusts entry.buffer */
|
||||||
|
String_InitArray(entry, entryBuffer);
|
||||||
|
|
||||||
res = Stream_ReadLine(&buffered, &entry);
|
res = Stream_ReadLine(&buffered, &entry);
|
||||||
if (res == ERR_END_OF_STREAM) break;
|
if (res == ERR_END_OF_STREAM) break;
|
||||||
if (res) { Logger_SysWarn2(res, "reading from", &path); break; }
|
if (res) { Logger_SysWarn2(res, "reading from", &path); break; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user