1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-03 16:53:36 +03:00

Make sure the shell does not try to put a zero terminator on the end of an

unallocated zero-length string when running ".import" on an empty file.

FossilOrigin-Name: 92adaee5bd31c152dbc1592f4aeb5d8da957a1ea
This commit is contained in:
drh
2013-07-12 21:09:24 +00:00
parent a95882ff39
commit 8dd675e43f
3 changed files with 8 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
C Change\sthe\sdescription\sof\show\ssqlite3_progress_handler()\sworks\sso\sthat\s\nthe\sN\sparameter\sis\s"approximate".\s\sThis\saligns\swith\sthe\scurrent\simplementation.\nThis\sis\sa\sdocumentation\schange\sonly.\s\sNo\schanges\sto\scode. C Make\ssure\sthe\sshell\sdoes\snot\stry\sto\sput\sa\szero\sterminator\son\sthe\send\sof\san\nunallocated\szero-length\sstring\swhen\srunning\s".import"\son\san\sempty\sfile.
D 2013-07-11T19:04:23.647 D 2013-07-12T21:09:24.523
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -217,7 +217,7 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c 89f9003e8316ee3a172795459efc2a0274e1d5a8 F src/resolve.c 89f9003e8316ee3a172795459efc2a0274e1d5a8
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0 F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
F src/select.c 91b62654caf8dfe292fb8882715e575d34ad3874 F src/select.c 91b62654caf8dfe292fb8882715e575d34ad3874
F src/shell.c c8cd06e6b66250a3ea0149c4edec30de14f57b6f F src/shell.c 4c02ec99e42aeb624bb221b253273da6c910b814
F src/sqlite.h.in c8b27ba43bb35a26b6067b8f24f06c24af2d1b64 F src/sqlite.h.in c8b27ba43bb35a26b6067b8f24f06c24af2d1b64
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0 F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
@@ -1103,7 +1103,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 6557c407983b067449deb76bc4c5248de64e07dc P 7d829bdea3adcda50fbe930acb4e1ce73fd874e6
R 045649ed68015430e04b85aae90e1909 R 3ed94849e5c017401e30c707fda6984e
U drh U drh
Z c98b2f615dfc222d1805fcdb692cca6b Z e4e9f4e449a4a8d9a8571763475fda13

View File

@@ -1 +1 @@
7d829bdea3adcda50fbe930acb4e1ce73fd874e6 92adaee5bd31c152dbc1592f4aeb5d8da957a1ea

View File

@@ -1721,7 +1721,6 @@ static char *csv_read_one_field(CSVReader *p){
|| (c==EOF && pc==cQuote) || (c==EOF && pc==cQuote)
){ ){
do{ p->n--; }while( p->z[p->n]!=cQuote ); do{ p->n--; }while( p->z[p->n]!=cQuote );
p->z[p->n] = 0;
p->cTerm = c; p->cTerm = c;
break; break;
} }
@@ -1732,7 +1731,6 @@ static char *csv_read_one_field(CSVReader *p){
if( c==EOF ){ if( c==EOF ){
fprintf(stderr, "%s:%d: unterminated %c-quoted field\n", fprintf(stderr, "%s:%d: unterminated %c-quoted field\n",
p->zFile, startLine, cQuote); p->zFile, startLine, cQuote);
p->z[p->n] = 0;
p->cTerm = EOF; p->cTerm = EOF;
break; break;
} }
@@ -1748,9 +1746,9 @@ static char *csv_read_one_field(CSVReader *p){
p->nLine++; p->nLine++;
if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--; if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--;
} }
p->z[p->n] = 0;
p->cTerm = c; p->cTerm = c;
} }
if( p->z ) p->z[p->n] = 0;
return p->z; return p->z;
} }