mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- fixed: FileReader::Gets did not check for a lump's end when reading through a WADs file object.
SVN r3496 (trunk)
This commit is contained in:
parent
6f824e5ec7
commit
d64ca20b31
1 changed files with 6 additions and 1 deletions
|
@ -145,11 +145,16 @@ long FileReader::Read (void *buffer, long len)
|
||||||
|
|
||||||
char *FileReader::Gets(char *strbuf, int len)
|
char *FileReader::Gets(char *strbuf, int len)
|
||||||
{
|
{
|
||||||
if (len <= 0) return 0;
|
if (len <= 0 || FilePos >= Length) return NULL;
|
||||||
char *p = fgets(strbuf, len, File);
|
char *p = fgets(strbuf, len, File);
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
|
int old = FilePos;
|
||||||
FilePos = ftell(File) - StartPos;
|
FilePos = ftell(File) - StartPos;
|
||||||
|
if (FilePos > Length)
|
||||||
|
{
|
||||||
|
strbuf[Length-old] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue