Fix some problems in test code detected by cppcheck.

FossilOrigin-Name: c9ff4ca4a0b44bbb8d6676144ddf77b04426e619
This commit is contained in:
dan
2015-08-05 08:01:46 +00:00
parent f9419d17ff
commit dca929040a
5 changed files with 23 additions and 17 deletions
+2 -2
View File
@@ -338,7 +338,7 @@ static int test_exec_hex(
int rc, i, j;
char *zErr = 0;
char *zHex;
char zSql[500];
char zSql[501];
char zBuf[30];
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
@@ -347,7 +347,7 @@ static int test_exec_hex(
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
zHex = argv[2];
for(i=j=0; i<sizeof(zSql) && zHex[j]; i++, j++){
for(i=j=0; i<(sizeof(zSql)-1) && zHex[j]; i++, j++){
if( zHex[j]=='%' && zHex[j+2] && zHex[j+2] ){
zSql[i] = (testHexToInt(zHex[j+1])<<4) + testHexToInt(zHex[j+2]);
j += 2;