1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
$NetBSD: patch-ai,v 1.2 2004/12/10 09:30:42 salo Exp $
--- gdk_imlib/io-ppm.c.orig 2002-03-04 18:06:29.000000000 +0100
+++ gdk_imlib/io-ppm.c 2004-12-10 10:00:56.000000000 +0100
@@ -50,15 +50,15 @@
if (s[0] != '#')
{
done = 0;
- sscanf(s, "%i %i", w, h);
+ sscanf(s, "%d %d", w, h);
a = *w;
b = *h;
- if (a > 32767)
+ if (a <= 0 || a > 32767)
{
fprintf(stderr, "gdk_imlib ERROR: Image width > 32767 pixels for file\n");
return NULL;
}
- if (b > 32767)
+ if (b <= 0 || b > 32767)
{
fprintf(stderr, "gdk_imlib ERROR: Image height > 32767 pixels for file\n");
return NULL;
@@ -66,7 +66,7 @@
if (!bw)
{
fgets(s, 256, f);
- sscanf(s, "%i", &scale);
+ sscanf(s, "%d", &scale);
}
else
scale = 99999;
|