ref: 921666f7046ed38ff42fe233d8cd0a5f83578418
parent: c4b93eb7944dd5e97a716c557c9d18c587b8f743
author: Fabian Greffrath <fabian@greffrath.com>
date: Sun Jan 20 15:48:30 EST 2019
glob: let I_NextGlob() return NULL if (glob == NULL) If a non-existent directory is passed over to I_StartGlob(), e.g. when moving config files between computers, it will return NULL. If this return value is then fed into I_NextGlob(), it will trigger a segmentation fault. Add a check to the latter if (glob == NULL) and let it return NULL itself in this case.
--- a/src/i_glob.c
+++ b/src/i_glob.c
@@ -319,6 +319,11 @@
{
const char *result;
+ if (glob == NULL)
+ {
+ return NULL;
+ }
+
// In unsorted mode we just return the filenames as we read
// them back from the system API.
if ((glob->flags & GLOB_FLAG_SORTED) == 0)