From: drh Date: Fri, 13 Feb 2004 20:09:41 +0000 (+0000) Subject: Fix an uninitialized variable in shell.c that would cause a crash if you X-Git-Tag: version-3.6.10~4830 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eceae45cb5dca1a0b3f5d50c7418cf66ec74d479;p=thirdparty%2Fsqlite.git Fix an uninitialized variable in shell.c that would cause a crash if you specified SQL on the command-line. (CVS 1238) FossilOrigin-Name: 5a56090dde10ee29863021356d21c3f8c86e3f46 --- diff --git a/manifest b/manifest index 62dd9b195c..ab3358950f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Begin\sthe\sprocess\sover\sconverting\ssqlite_exec()\sover\sto\suse\ssqlite_compile()\nand\ssqlite_step().\s\sThe\snew\ssqlite_exec()\sis\sstill\scommented\sout.\s(CVS\s1237) -D 2004-02-13T16:30:10 +C Fix\san\suninitialized\svariable\sin\sshell.c\sthat\swould\scause\sa\scrash\sif\syou\nspecified\sSQL\son\sthe\scommand-line.\s(CVS\s1238) +D 2004-02-13T20:09:42 F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -47,7 +47,7 @@ F src/pragma.c 89d62c31c6f0a43376fe8d20549b87a6d30c467a F src/printf.c 84e4ea4ba49cbbf930e95e82295127ad5843ae1f F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2 F src/select.c da4f383736a5dacf7ff856de091ffd1ca9874623 -F src/shell.c f6975f87264d04398c9ffa51117c6e3a7f4f4396 +F src/shell.c 60b33fe4b3efc0756c94efe842bbfe7459b21410 F src/sqlite.h.in 64f016cd5ce190643a0f47760188fdf4e0b2227e F src/sqliteInt.h c45fbae6278407111d7a00aa9280ddc0f51344ad F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895 @@ -184,7 +184,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P aa0490ccd4a820a707dfb4905e67c01ffb4f758b -R 3d4312db1b01209de5e7a503534ee386 +P b8f2ba7880b761e380b95ae63d8ab721f018443e +R ac40d97ad6dd273a312a257b7d180e8b U drh -Z 4885952f027f0f0cf39c7f995fa7e947 +Z 0483d0dbd60616591796c1d3c8bd0cf7 diff --git a/manifest.uuid b/manifest.uuid index 131eeb05ea..175cdbd769 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b8f2ba7880b761e380b95ae63d8ab721f018443e \ No newline at end of file +5a56090dde10ee29863021356d21c3f8c86e3f46 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 2a466f88de..498c51b395 100644 --- a/src/shell.c +++ b/src/shell.c @@ -12,7 +12,7 @@ ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** -** $Id: shell.c,v 1.88 2004/02/12 20:49:36 drh Exp $ +** $Id: shell.c,v 1.89 2004/02/13 20:09:42 drh Exp $ */ #include #include @@ -513,9 +513,9 @@ static void open_db(struct callback_data *p){ char *zErrMsg = 0; #ifdef SQLITE_HAS_CODEC int n = p->zKey ? strlen(p->zKey) : 0; - p->db = sqlite_open_encrypted(p->zDbFilename, p->zKey, n, 0, &zErrMsg); + db = p->db = sqlite_open_encrypted(p->zDbFilename, p->zKey, n, 0, &zErrMsg); #else - p->db = sqlite_open(p->zDbFilename, 0, &zErrMsg); + db = p->db = sqlite_open(p->zDbFilename, 0, &zErrMsg); #endif if( p->db==0 ){ if( zErrMsg ){ @@ -1314,7 +1314,7 @@ int main(int argc, char **argv){ }else{ int rc; open_db(&data); - rc = sqlite_exec(db, zFirstCmd, callback, &data, &zErrMsg); + rc = sqlite_exec(data.db, zFirstCmd, callback, &data, &zErrMsg); if( rc!=0 && zErrMsg!=0 ){ fprintf(stderr,"SQL error: %s\n", zErrMsg); exit(1);