1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +01:00

WRaster: Stop parsing number in PPM file if invalid syntax is found

When the function 'pm_getuint' is reading a number, it prints an error
message if it encounters a non-digit number, yet it still enters the
processing loop which will cause an invalid number to be calculated.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2021-05-16 15:47:08 +02:00
committed by Carlos R. Mafra
parent 8e47ca8e62
commit d125f80dee

View File

@@ -85,8 +85,10 @@ int pm_getuint(FILE * const ifP)
ch = pm_getc(ifP);
} while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
if (ch < '0' || ch > '9')
if (ch < '0' || ch > '9') {
fprintf(stderr, "junk in file where an unsigned integer should be\n");
return -1;
}
i = 0;
do {