summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2012-05-22 09:10:10 +0000
committerMarc Espie <espie@cvs.openbsd.org>2012-05-22 09:10:10 +0000
commit31e9a7a7162fd0b640e64237f5d19fd9e00eb2b4 (patch)
tree256fe1b97abd4e8551c0a27ecc06680e746d463f
parent62bea803a599c9c7d013d378bbdfe639108adaab (diff)
lemon bug: checking lines is not enough, we have to be sure we're at the
end of file to make sure the include file hasn't been altered. problem reported by landry@, deraadt@
-rw-r--r--lib/libsqlite3/tool/lemon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libsqlite3/tool/lemon.c b/lib/libsqlite3/tool/lemon.c
index c3e612b068e..0b41bdc44b7 100644
--- a/lib/libsqlite3/tool/lemon.c
+++ b/lib/libsqlite3/tool/lemon.c
@@ -1546,7 +1546,7 @@ int main(int argc, char **argv)
/*
** Return a pointer to the next structure in the linked list.
*/
-#define NEXT(A) (*(char**)(((unsigned long)A)+offset))
+#define NEXT(A) (*(char**)(((char*)A)+offset))
/*
** Inputs:
@@ -4025,8 +4025,9 @@ void ReportHeader(struct lemon *lemp)
sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i);
if( strcmp(line,pattern) ) break;
}
+ int eof = fgetc(in);
fclose(in);
- if( i==lemp->nterminal ){
+ if( i==lemp->nterminal && eof == EOF ){
/* No change in the file. Don't rewrite it. */
return;
}