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

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