mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-24 12:02:08 +00:00
Merge pull request #507 from JL2210/null-pointer-fix-1
Fix possible null pointer dereference
This commit is contained in:
@@ -254,7 +254,7 @@ YY_BUFFER_STATE yy_create_buffer(FILE *f)
|
||||
else if (capacity == 0)
|
||||
capacity = 1;
|
||||
|
||||
while (!feof(f)) {
|
||||
do {
|
||||
if (buf == NULL || size >= capacity) {
|
||||
if (buf)
|
||||
capacity *= 2;
|
||||
@@ -273,7 +273,7 @@ YY_BUFFER_STATE yy_create_buffer(FILE *f)
|
||||
fatalerror("%s: fread error", __func__);
|
||||
|
||||
size += read_count;
|
||||
}
|
||||
} while (!feof(f));
|
||||
|
||||
pBuffer->pBufferRealStart = buf;
|
||||
pBuffer->pBufferStart = buf + SAFETYMARGIN;
|
||||
|
||||
Reference in New Issue
Block a user