mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-19 21:34:12 +01:00
Fixed bug related to incorrect reading of ppm files.
This commit is contained in:
@@ -46,14 +46,14 @@ load_graymap(char *file_name, FILE *file, int w, int h, int max, int raw)
|
|||||||
int x, y;
|
int x, y;
|
||||||
char *buf, *ptr;
|
char *buf, *ptr;
|
||||||
|
|
||||||
buf = malloc(w);
|
buf = malloc(w+1);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = image->data;
|
ptr = image->data;
|
||||||
for (y = 0; y < h; y++) {
|
for (y = 0; y < h; y++) {
|
||||||
if (!fgets(buf, w, file)) {
|
if (!fread(buf, w, 1, file)) {
|
||||||
free(buf);
|
free(buf);
|
||||||
goto short_file;
|
goto short_file;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user