Enhance sqlite3_bind_parameter_index so that is does not segfault if

you call it incorrectly by passing NULL in place of the parameter name.
Ticket #1032. (CVS 2159)

FossilOrigin-Name: bf81aabff1303b66f12d28b730d19b7cbdb2de6a
This commit is contained in:
drh 2004-12-09 18:29:13 +00:00
parent 2530378003
commit 10fb11da9e
3 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Only\sevaluate\sexpressions\sonce\sfor\sUPDATE\sand\sINSERT\sstatements\sthat\nhave\sBEFORE\striggers.\s\sFix\sfor\sticket\s#980.\s(CVS\s2158) C Enhance\ssqlite3_bind_parameter_index\sso\sthat\sis\sdoes\snot\ssegfault\sif\nyou\scall\sit\sincorrectly\sby\spassing\sNULL\sin\splace\sof\sthe\sparameter\sname.\nTicket\s#1032.\s(CVS\s2159)
D 2004-12-07T15:41:49 D 2004-12-09T18:29:14
F Makefile.in da09f379b80c8cd78d78abaa0f32ca90a124e884 F Makefile.in da09f379b80c8cd78d78abaa0f32ca90a124e884
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@ -79,7 +79,7 @@ F src/vacuum.c 705256e1111521fa04f0029de7f1667bc131d015
F src/vdbe.c aaec606fb513102314ca351006cea6656791bdcf F src/vdbe.c aaec606fb513102314ca351006cea6656791bdcf
F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181 F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181
F src/vdbeInt.h 0f74561e629af86172de7cdf0ecaea014c51696c F src/vdbeInt.h 0f74561e629af86172de7cdf0ecaea014c51696c
F src/vdbeapi.c 74be7f96c0a1ac275661f8b32276ac521d9ce37c F src/vdbeapi.c 12ba371446b7ae0fe1f827d8df5ea399dfe52444
F src/vdbeaux.c a7c4c90786e2633b38f2d89f3dc49aed747454e4 F src/vdbeaux.c a7c4c90786e2633b38f2d89f3dc49aed747454e4
F src/vdbemem.c 5876c8abf4374fef671f4fd8dc333ef3fc95a2f0 F src/vdbemem.c 5876c8abf4374fef671f4fd8dc333ef3fc95a2f0
F src/where.c f9d3b6f2243a0eb9065fa4c465fe0831a64b7db7 F src/where.c f9d3b6f2243a0eb9065fa4c465fe0831a64b7db7
@ -263,7 +263,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
P 8e164ab27771aced9a592ea4b7c27e9f184181a5 P 4852186aca3be6ea40069b6831079197e5fa757a
R a25e54595d969baf18fc12c2ed784b4c R 5fd97097019f1cf381f7aeb138d90537
U drh U drh
Z c29cc9b7f0c7e31234ed5d8c1f56e385 Z 833ca72c036e88e0bff95a97e8783ab0

View File

@ -1 +1 @@
4852186aca3be6ea40069b6831079197e5fa757a bf81aabff1303b66f12d28b730d19b7cbdb2de6a

View File

@ -593,7 +593,7 @@ int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
createVarMap(p); createVarMap(p);
for(i=0; i<p->nVar; i++){ for(i=0; i<p->nVar; i++){
const char *z = p->azVar[i]; const char *z = p->azVar[i];
if( z && strcmp(z,zName)==0 ){ if( z && zName && strcmp(z,zName)==0 ){
return i+1; return i+1;
} }
} }