[mingw-sqlite: 19/31] fix patch
Kalev Lember
kalev at fedoraproject.org
Tue Mar 6 21:33:35 UTC 2012
commit 279919f6c6d953e0ffef4a535233634e5c6b9fbd
Author: Thomas Sailer <t.sailer at alumni.ethz.ch>
Date: Mon Dec 6 18:54:54 2010 +0100
fix patch
mingw32-sqlite.spec | 2 +-
sqlite-3.6.6.2-lemon-snprintf.patch | 111 -----------------------------------
sqlite-3.7.3-lemon-snprintf.patch | 76 ++++++++++++++++++++++++
3 files changed, 77 insertions(+), 112 deletions(-)
---
diff --git a/mingw32-sqlite.spec b/mingw32-sqlite.spec
index 855eb4a..421668d 100644
--- a/mingw32-sqlite.spec
+++ b/mingw32-sqlite.spec
@@ -25,7 +25,7 @@ BuildArch: noarch
# Patches from Fedora native package.
Patch1: sqlite-3.6.12-libdl.patch
# Avoid insecure sprintf(), use a system path for lempar.c, patch from Debian
-Patch2: sqlite-3.6.6.2-lemon-snprintf.patch
+Patch2: sqlite-3.7.3-lemon-snprintf.patch
# Patches for MinGW port.
Patch1000: mingw32-sqlite-3.6.12-no-undefined.patch
diff --git a/sqlite-3.7.3-lemon-snprintf.patch b/sqlite-3.7.3-lemon-snprintf.patch
new file mode 100644
index 0000000..98e48e3
--- /dev/null
+++ b/sqlite-3.7.3-lemon-snprintf.patch
@@ -0,0 +1,76 @@
+diff -up sqlite-3.7.3/tool/lemon.c.lemparpath sqlite-3.7.3/tool/lemon.c
+--- sqlite-3.7.3/tool/lemon.c.lemparpath 2008-12-05 20:37:49.000000000 +0200
++++ sqlite-3.7.3/tool/lemon.c 2008-12-05 20:44:08.000000000 +0200
+@@ -2363,7 +2363,7 @@
+ for(z=psp->filename, nBack=0; *z; z++){
+ if( *z=='\\' ) nBack++;
+ }
+- sprintf(zLine, "#line %d ", psp->tokenlineno);
++ snprintf(zLine, sizeof zLine, "#line %d ", psp->tokenlineno);
+ nLine = lemonStrlen(zLine);
+ n += nLine + lemonStrlen(psp->filename) + nBack;
+ }
+@@ -2947,7 +2947,7 @@
+ while( cfp ){
+ char buf[20];
+ if( cfp->dot==cfp->rp->nrhs ){
+- sprintf(buf,"(%d)",cfp->rp->index);
++ snprintf(buf,sizeof buf,"(%d)",cfp->rp->index);
+ fprintf(fp," %5s ",buf);
+ }else{
+ fprintf(fp," ");
+@@ -3118,14 +3118,16 @@
+
+ cp = strrchr(lemp->filename,'.');
+ if( cp ){
+- sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename);
++ snprintf(buf,sizeof buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename);
+ }else{
+- sprintf(buf,"%s.lt",lemp->filename);
++ snprintf(buf,sizeof buf,"%s.lt",lemp->filename);
+ }
+ if( access(buf,004)==0 ){
+ tpltname = buf;
+ }else if( access(templatename,004)==0 ){
+ tpltname = templatename;
++ }else if( access("/usr/share/lemon/lempar.c",004)==0 ){
++ tpltname = "/usr/share/lemon/lempar.c";
+ }else{
+ tpltname = pathsearch(lemp->argv0,templatename,0);
+ }
+@@ -3137,7 +3139,7 @@
+ }
+ in = fopen(tpltname,"rb");
+ if( in==0 ){
+- fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
++ fprintf(stderr,"Can't open the template file \"%s\".\n",tpltname);
+ lemp->errorcnt++;
+ return 0;
+ }
+@@ -3271,7 +3273,7 @@
+ while( n-- > 0 ){
+ c = *(zText++);
+ if( c=='%' && n>0 && zText[0]=='d' ){
+- sprintf(zInt, "%d", p1);
++ snprintf(zInt, sizeof zInt, "%d", p1);
+ p1 = p2;
+ strcpy(&z[used], zInt);
+ used += lemonStrlen(&z[used]);
+@@ -3883,7 +3885,7 @@
+ /* Generate a table containing the symbolic name of every symbol
+ */
+ for(i=0; i<lemp->nsymbol; i++){
+- sprintf(line,"\"%s\",",lemp->symbols[i]->name);
++ snprintf(line,sizeof line,"\"%s\",",lemp->symbols[i]->name);
+ fprintf(out," %-15s",line);
+ if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; }
+ }
+@@ -4049,7 +4051,7 @@
+ in = file_open(lemp,".h","rb");
+ if( in ){
+ for(i=1; i<lemp->nterminal && fgets(line,LINESIZE,in); i++){
+- sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i);
++ snprintf(pattern,sizeof pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i);
+ if( strcmp(line,pattern) ) break;
+ }
+ fclose(in);
More information about the scm-commits
mailing list