1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-06 05:44:11 +01:00

Fixed bug related to incorrect reading of ppm files.

This commit is contained in:
dan
2000-09-28 12:07:38 +00:00
parent 8382063736
commit 44fd05f1c3

View File

@@ -46,14 +46,14 @@ load_graymap(char *file_name, FILE *file, int w, int h, int max, int raw)
int x, y;
char *buf, *ptr;
buf = malloc(w);
buf = malloc(w+1);
if (!buf) {
return NULL;
}
ptr = image->data;
for (y = 0; y < h; y++) {
if (!fgets(buf, w, file)) {
if (!fread(buf, w, 1, file)) {
free(buf);
goto short_file;
}