qc_sqlite: Recognize backslash as escape character

Without this change, e.g.

    insert into t1 values('\'');

causes a buffer overflow and crash.
This commit is contained in:
Johan Wikman
2016-09-29 22:50:18 +03:00
parent 4658a28965
commit ca76cb1576

View File

@ -219,6 +219,15 @@ int sqlite3Dequote(char *z){
}
for(i=1, j=0;; i++){
assert( z[i] );
#ifdef MAXSCALE
if ( z[i]=='\\' ){
z[j++] = '\\';
if ( z[i+1]==quote || z[i+1]=='\\' ){
z[j++] = quote;
i++;
}
} else
#endif
if( z[i]==quote ){
if( z[i+1]==quote ){
z[j++] = quote;