ref: 5941db63fff0d5793b7990ee242ac95decba0abb
parent: f39a5d2cd1f33d5319f8870d03beb71d281ebfb6
author: Turo Lamminen <[email protected]>
date: Sat Jan 6 10:35:40 EST 2018
i_sdlmusic: Don't ignore return value of fgets() call
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -649,8 +649,15 @@
while (!feof(fs))
{
+ char *retval;
M_StringCopy(line, "", sizeof(line));
- fgets(line, sizeof(line), fs);
+ retval = fgets(line, sizeof(line), fs);
+
+ if (retval == NULL)
+ {
+ fprintf(stderr, "%s:%i: Unexpected end of file\n", filename, linenum);
+ break;
+ }
error = ParseSubstituteLine(filename, line);