diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index aa22e0cdab..ce189f981c 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -221,6 +221,9 @@ int filestream_scanf(RFILE *stream, const char* format, ...) int ret = 0; int64_t maxlen = filestream_read(stream, buf, sizeof(buf)-1); + if (maxlen <= 0) + return EOF; + buf[maxlen] = '\0'; va_start(args, format);