|
|
a1d9494 |
Prevent sscanf stack smashing, and fix two GCC warnings.
|
|
|
a1d9494 |
|
|
|
a1d9494 |
diff -Nur compface-1.5.2-prepped/file.c compface-1.5.2-modified/file.c
|
|
|
a1d9494 |
--- compface-1.5.2-prepped/file.c 2006-08-04 18:58:17.000000000 +0200
|
|
|
a1d9494 |
+++ compface-1.5.2-modified/file.c 2006-08-04 18:59:30.000000000 +0200
|
|
|
a1d9494 |
@@ -80,7 +80,7 @@
|
|
|
a1d9494 |
static char table_inv[] = { 0,8,4,12,2,10,6,14,1,9, 5,13, 3,11, 7,15 };
|
|
|
a1d9494 |
static char table_nop[] = { 0,1,2, 3,4, 5,6, 7,8,9,10,11,12,13,14,15 };
|
|
|
a1d9494 |
char *table = table_nop; /* optionally invert bits in nibble */
|
|
|
a1d9494 |
- register inc = 0; /* optionally swap nimmles */
|
|
|
a1d9494 |
+ register int inc = 0; /* optionally swap nimmles */
|
|
|
a1d9494 |
int bits;
|
|
|
a1d9494 |
|
|
|
a1d9494 |
t = s = fbuf;
|
|
|
a1d9494 |
@@ -91,9 +91,9 @@
|
|
|
a1d9494 |
char type1[128];
|
|
|
a1d9494 |
char type2[128];
|
|
|
a1d9494 |
while (*s && *s++ != '\n');
|
|
|
a1d9494 |
- if (sscanf(s, "#define %*s %d", &bits) == 1) if (bits == 48) {
|
|
|
a1d9494 |
+ if ((sscanf(s, "#define %*s %d", &bits) == 1) && (bits == 48)) {
|
|
|
a1d9494 |
while (*s && *s++ != '\n');
|
|
|
a1d9494 |
- if (sscanf(s, "static %s %s", type1,type2)==2 &&
|
|
|
a1d9494 |
+ if (sscanf(s, "static %127s %127s", type1,type2)==2 &&
|
|
|
a1d9494 |
(!strcmp(type1, "char") ||
|
|
|
a1d9494 |
!strcmp(type2, "char"))) {
|
|
|
a1d9494 |
while (*s && *s++ != '\n');
|