Don't ignore the return value of fgets() and fread()
parent
1b00c8c3ab
commit
7715fd1bb8
3
file.cpp
3
file.cpp
|
@ -382,7 +382,8 @@ void SolveSpace::LoadUsingTable(char *key, char *val) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
EntityMap em;
|
EntityMap em;
|
||||||
char line2[1024];
|
char line2[1024];
|
||||||
fgets(line2, (int)sizeof(line2), fh);
|
if (fgets(line2, (int)sizeof(line2), fh) == NULL)
|
||||||
|
break;
|
||||||
if(sscanf(line2, "%d %x %d", &(em.h.v), &(em.input.v),
|
if(sscanf(line2, "%d %x %d", &(em.h.v), &(em.input.v),
|
||||||
&(em.copyNumber)) == 3)
|
&(em.copyNumber)) == 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -381,7 +381,8 @@ void TextWindow::ScreenBackgroundImage(int link, DWORD v) {
|
||||||
if(!f) goto err;
|
if(!f) goto err;
|
||||||
|
|
||||||
BYTE header[8];
|
BYTE header[8];
|
||||||
fread(header, 1, 8, f);
|
if (fread(header, 1, 8, f) != 8)
|
||||||
|
goto err;
|
||||||
if(png_sig_cmp(header, 0, 8)) goto err;
|
if(png_sig_cmp(header, 0, 8)) goto err;
|
||||||
|
|
||||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||||
|
|
Loading…
Reference in New Issue