Fossil SCM
Clear compiler warnings on OpenBSD. No functional code changes.
Commit
bbbb35a3c68f96f01bcae4700d8b23bb9ecaa936
Parent
d45502b066b0305…
10 files changed
+2
-2
+2
-2
+1
-1
+3
-3
+2
-2
+1
-1
+2
-2
+5
-5
+1
-1
+5
-3
M
src/db.c
+2
-2
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -777,11 +777,11 @@ | ||
| 777 | 777 | strncpy(zPwd, zPwdConv, 2000-20); |
| 778 | 778 | free(zPwdConv); |
| 779 | 779 | while( n>0 ){ |
| 780 | 780 | if( access(zPwd, W_OK) ) break; |
| 781 | 781 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 782 | - strcpy(&zPwd[n], aDbName[i]); | |
| 782 | + sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); | |
| 783 | 783 | if( isValidLocalDb(zPwd) ){ |
| 784 | 784 | /* Found a valid checkout database file */ |
| 785 | 785 | zPwd[n] = 0; |
| 786 | 786 | while( n>1 && zPwd[n-1]=='/' ){ |
| 787 | 787 | n--; |
| @@ -1227,11 +1227,11 @@ | ||
| 1227 | 1227 | memcpy(zHash, zContent, n); |
| 1228 | 1228 | zHash[n] = 0; |
| 1229 | 1229 | }else{ |
| 1230 | 1230 | sha1sum_step_text(zContent, n); |
| 1231 | 1231 | sha1sum_finish(&out); |
| 1232 | - strcpy(zHash, blob_str(&out)); | |
| 1232 | + sqlite3_snprintf(sizeof(zHash), zHash, "%s", blob_str(&out)); | |
| 1233 | 1233 | blob_reset(&out); |
| 1234 | 1234 | db_multi_exec( |
| 1235 | 1235 | "INSERT OR IGNORE INTO concealed VALUES(%Q,%#Q)", |
| 1236 | 1236 | zHash, n, zContent |
| 1237 | 1237 | ); |
| 1238 | 1238 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -777,11 +777,11 @@ | |
| 777 | strncpy(zPwd, zPwdConv, 2000-20); |
| 778 | free(zPwdConv); |
| 779 | while( n>0 ){ |
| 780 | if( access(zPwd, W_OK) ) break; |
| 781 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 782 | strcpy(&zPwd[n], aDbName[i]); |
| 783 | if( isValidLocalDb(zPwd) ){ |
| 784 | /* Found a valid checkout database file */ |
| 785 | zPwd[n] = 0; |
| 786 | while( n>1 && zPwd[n-1]=='/' ){ |
| 787 | n--; |
| @@ -1227,11 +1227,11 @@ | |
| 1227 | memcpy(zHash, zContent, n); |
| 1228 | zHash[n] = 0; |
| 1229 | }else{ |
| 1230 | sha1sum_step_text(zContent, n); |
| 1231 | sha1sum_finish(&out); |
| 1232 | strcpy(zHash, blob_str(&out)); |
| 1233 | blob_reset(&out); |
| 1234 | db_multi_exec( |
| 1235 | "INSERT OR IGNORE INTO concealed VALUES(%Q,%#Q)", |
| 1236 | zHash, n, zContent |
| 1237 | ); |
| 1238 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -777,11 +777,11 @@ | |
| 777 | strncpy(zPwd, zPwdConv, 2000-20); |
| 778 | free(zPwdConv); |
| 779 | while( n>0 ){ |
| 780 | if( access(zPwd, W_OK) ) break; |
| 781 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 782 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 783 | if( isValidLocalDb(zPwd) ){ |
| 784 | /* Found a valid checkout database file */ |
| 785 | zPwd[n] = 0; |
| 786 | while( n>1 && zPwd[n-1]=='/' ){ |
| 787 | n--; |
| @@ -1227,11 +1227,11 @@ | |
| 1227 | memcpy(zHash, zContent, n); |
| 1228 | zHash[n] = 0; |
| 1229 | }else{ |
| 1230 | sha1sum_step_text(zContent, n); |
| 1231 | sha1sum_finish(&out); |
| 1232 | sqlite3_snprintf(sizeof(zHash), zHash, "%s", blob_str(&out)); |
| 1233 | blob_reset(&out); |
| 1234 | db_multi_exec( |
| 1235 | "INSERT OR IGNORE INTO concealed VALUES(%Q,%#Q)", |
| 1236 | zHash, n, zContent |
| 1237 | ); |
| 1238 |
+2
-2
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -290,11 +290,11 @@ | ||
| 290 | 290 | for(i=0; zName[i]; i++){ |
| 291 | 291 | if( zName[i]=='.' ) z = &zName[i+1]; |
| 292 | 292 | } |
| 293 | 293 | len = strlen(z); |
| 294 | 294 | if( len<sizeof(zSuffix)-1 ){ |
| 295 | - strcpy(zSuffix, z); | |
| 295 | + sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z); | |
| 296 | 296 | for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]); |
| 297 | 297 | first = 0; |
| 298 | 298 | last = sizeof(aMime)/sizeof(aMime[0]); |
| 299 | 299 | while( first<=last ){ |
| 300 | 300 | int c; |
| @@ -347,11 +347,11 @@ | ||
| 347 | 347 | while( zName[0]=='/' ){ zName++; } |
| 348 | 348 | if( !file_is_simple_pathname(zName) ){ |
| 349 | 349 | goto doc_not_found; |
| 350 | 350 | } |
| 351 | 351 | if( strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){ |
| 352 | - strcpy(zBaseline,"tip"); | |
| 352 | + sqlite3_snprintf(sizeof(zBaseline), zBaseline, "tip"); | |
| 353 | 353 | } |
| 354 | 354 | if( strcmp(zBaseline,"ckout")==0 ){ |
| 355 | 355 | /* Read from the local checkout */ |
| 356 | 356 | char *zFullpath; |
| 357 | 357 | db_must_be_within_tree(); |
| 358 | 358 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -290,11 +290,11 @@ | |
| 290 | for(i=0; zName[i]; i++){ |
| 291 | if( zName[i]=='.' ) z = &zName[i+1]; |
| 292 | } |
| 293 | len = strlen(z); |
| 294 | if( len<sizeof(zSuffix)-1 ){ |
| 295 | strcpy(zSuffix, z); |
| 296 | for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]); |
| 297 | first = 0; |
| 298 | last = sizeof(aMime)/sizeof(aMime[0]); |
| 299 | while( first<=last ){ |
| 300 | int c; |
| @@ -347,11 +347,11 @@ | |
| 347 | while( zName[0]=='/' ){ zName++; } |
| 348 | if( !file_is_simple_pathname(zName) ){ |
| 349 | goto doc_not_found; |
| 350 | } |
| 351 | if( strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){ |
| 352 | strcpy(zBaseline,"tip"); |
| 353 | } |
| 354 | if( strcmp(zBaseline,"ckout")==0 ){ |
| 355 | /* Read from the local checkout */ |
| 356 | char *zFullpath; |
| 357 | db_must_be_within_tree(); |
| 358 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -290,11 +290,11 @@ | |
| 290 | for(i=0; zName[i]; i++){ |
| 291 | if( zName[i]=='.' ) z = &zName[i+1]; |
| 292 | } |
| 293 | len = strlen(z); |
| 294 | if( len<sizeof(zSuffix)-1 ){ |
| 295 | sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z); |
| 296 | for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]); |
| 297 | first = 0; |
| 298 | last = sizeof(aMime)/sizeof(aMime[0]); |
| 299 | while( first<=last ){ |
| 300 | int c; |
| @@ -347,11 +347,11 @@ | |
| 347 | while( zName[0]=='/' ){ zName++; } |
| 348 | if( !file_is_simple_pathname(zName) ){ |
| 349 | goto doc_not_found; |
| 350 | } |
| 351 | if( strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){ |
| 352 | sqlite3_snprintf(sizeof(zBaseline), zBaseline, "tip"); |
| 353 | } |
| 354 | if( strcmp(zBaseline,"ckout")==0 ){ |
| 355 | /* Read from the local checkout */ |
| 356 | char *zFullpath; |
| 357 | db_must_be_within_tree(); |
| 358 |
+1
-1
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -248,11 +248,11 @@ | ||
| 248 | 248 | char zShort[20]; |
| 249 | 249 | char zShortCkin[20]; |
| 250 | 250 | if( zBr==0 ) zBr = "trunk"; |
| 251 | 251 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr); |
| 252 | 252 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 253 | - sprintf(zPrevDate, "%.10s", zDate); | |
| 253 | + sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); | |
| 254 | 254 | @ <tr><td> |
| 255 | 255 | @ <div class="divider">%s(zPrevDate)</div> |
| 256 | 256 | @ </td></tr> |
| 257 | 257 | } |
| 258 | 258 | memcpy(zTime, &zDate[11], 5); |
| 259 | 259 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -248,11 +248,11 @@ | |
| 248 | char zShort[20]; |
| 249 | char zShortCkin[20]; |
| 250 | if( zBr==0 ) zBr = "trunk"; |
| 251 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr); |
| 252 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 253 | sprintf(zPrevDate, "%.10s", zDate); |
| 254 | @ <tr><td> |
| 255 | @ <div class="divider">%s(zPrevDate)</div> |
| 256 | @ </td></tr> |
| 257 | } |
| 258 | memcpy(zTime, &zDate[11], 5); |
| 259 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -248,11 +248,11 @@ | |
| 248 | char zShort[20]; |
| 249 | char zShortCkin[20]; |
| 250 | if( zBr==0 ) zBr = "trunk"; |
| 251 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr); |
| 252 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 253 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 254 | @ <tr><td> |
| 255 | @ <div class="divider">%s(zPrevDate)</div> |
| 256 | @ </td></tr> |
| 257 | } |
| 258 | memcpy(zTime, &zDate[11], 5); |
| 259 |
+3
-3
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -975,11 +975,11 @@ | ||
| 975 | 975 | zLine[0] = zHex[(i>>24)&0xf]; |
| 976 | 976 | zLine[1] = zHex[(i>>16)&0xf]; |
| 977 | 977 | zLine[2] = zHex[(i>>8)&0xf]; |
| 978 | 978 | zLine[3] = zHex[i&0xf]; |
| 979 | 979 | zLine[4] = ':'; |
| 980 | - sprintf(zLine, "%04x: ", i); | |
| 980 | + sqlite3_snprintf(sizeof(zLine), zLine, "%04x: ", i); | |
| 981 | 981 | for(j=0; j<16; j++){ |
| 982 | 982 | k = 5+j*3; |
| 983 | 983 | zLine[k] = ' '; |
| 984 | 984 | if( i+j<n ){ |
| 985 | 985 | unsigned char c = x[i+j]; |
| @@ -1478,11 +1478,11 @@ | ||
| 1478 | 1478 | ); |
| 1479 | 1479 | while( db_step(&q)==SQLITE_ROW ){ |
| 1480 | 1480 | int tagid = db_column_int(&q, 0); |
| 1481 | 1481 | const char *zTag = db_column_text(&q, 1); |
| 1482 | 1482 | char zLabel[30]; |
| 1483 | - sprintf(zLabel, "c%d", tagid); | |
| 1483 | + sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid); | |
| 1484 | 1484 | if( P(zLabel) ){ |
| 1485 | 1485 | db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag); |
| 1486 | 1486 | } |
| 1487 | 1487 | } |
| 1488 | 1488 | db_finalize(&q); |
| @@ -1613,11 +1613,11 @@ | ||
| 1613 | 1613 | ); |
| 1614 | 1614 | while( db_step(&q)==SQLITE_ROW ){ |
| 1615 | 1615 | int tagid = db_column_int(&q, 0); |
| 1616 | 1616 | const char *zTagName = db_column_text(&q, 1); |
| 1617 | 1617 | char zLabel[30]; |
| 1618 | - sprintf(zLabel, "c%d", tagid); | |
| 1618 | + sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid); | |
| 1619 | 1619 | if( P(zLabel) ){ |
| 1620 | 1620 | @ <br /><input type="checkbox" name="c%d(tagid)" checked="checked" /> |
| 1621 | 1621 | }else{ |
| 1622 | 1622 | @ <br /><input type="checkbox" name="c%d(tagid)" /> |
| 1623 | 1623 | } |
| 1624 | 1624 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -975,11 +975,11 @@ | |
| 975 | zLine[0] = zHex[(i>>24)&0xf]; |
| 976 | zLine[1] = zHex[(i>>16)&0xf]; |
| 977 | zLine[2] = zHex[(i>>8)&0xf]; |
| 978 | zLine[3] = zHex[i&0xf]; |
| 979 | zLine[4] = ':'; |
| 980 | sprintf(zLine, "%04x: ", i); |
| 981 | for(j=0; j<16; j++){ |
| 982 | k = 5+j*3; |
| 983 | zLine[k] = ' '; |
| 984 | if( i+j<n ){ |
| 985 | unsigned char c = x[i+j]; |
| @@ -1478,11 +1478,11 @@ | |
| 1478 | ); |
| 1479 | while( db_step(&q)==SQLITE_ROW ){ |
| 1480 | int tagid = db_column_int(&q, 0); |
| 1481 | const char *zTag = db_column_text(&q, 1); |
| 1482 | char zLabel[30]; |
| 1483 | sprintf(zLabel, "c%d", tagid); |
| 1484 | if( P(zLabel) ){ |
| 1485 | db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag); |
| 1486 | } |
| 1487 | } |
| 1488 | db_finalize(&q); |
| @@ -1613,11 +1613,11 @@ | |
| 1613 | ); |
| 1614 | while( db_step(&q)==SQLITE_ROW ){ |
| 1615 | int tagid = db_column_int(&q, 0); |
| 1616 | const char *zTagName = db_column_text(&q, 1); |
| 1617 | char zLabel[30]; |
| 1618 | sprintf(zLabel, "c%d", tagid); |
| 1619 | if( P(zLabel) ){ |
| 1620 | @ <br /><input type="checkbox" name="c%d(tagid)" checked="checked" /> |
| 1621 | }else{ |
| 1622 | @ <br /><input type="checkbox" name="c%d(tagid)" /> |
| 1623 | } |
| 1624 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -975,11 +975,11 @@ | |
| 975 | zLine[0] = zHex[(i>>24)&0xf]; |
| 976 | zLine[1] = zHex[(i>>16)&0xf]; |
| 977 | zLine[2] = zHex[(i>>8)&0xf]; |
| 978 | zLine[3] = zHex[i&0xf]; |
| 979 | zLine[4] = ':'; |
| 980 | sqlite3_snprintf(sizeof(zLine), zLine, "%04x: ", i); |
| 981 | for(j=0; j<16; j++){ |
| 982 | k = 5+j*3; |
| 983 | zLine[k] = ' '; |
| 984 | if( i+j<n ){ |
| 985 | unsigned char c = x[i+j]; |
| @@ -1478,11 +1478,11 @@ | |
| 1478 | ); |
| 1479 | while( db_step(&q)==SQLITE_ROW ){ |
| 1480 | int tagid = db_column_int(&q, 0); |
| 1481 | const char *zTag = db_column_text(&q, 1); |
| 1482 | char zLabel[30]; |
| 1483 | sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid); |
| 1484 | if( P(zLabel) ){ |
| 1485 | db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag); |
| 1486 | } |
| 1487 | } |
| 1488 | db_finalize(&q); |
| @@ -1613,11 +1613,11 @@ | |
| 1613 | ); |
| 1614 | while( db_step(&q)==SQLITE_ROW ){ |
| 1615 | int tagid = db_column_int(&q, 0); |
| 1616 | const char *zTagName = db_column_text(&q, 1); |
| 1617 | char zLabel[30]; |
| 1618 | sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid); |
| 1619 | if( P(zLabel) ){ |
| 1620 | @ <br /><input type="checkbox" name="c%d(tagid)" checked="checked" /> |
| 1621 | }else{ |
| 1622 | @ <br /><input type="checkbox" name="c%d(tagid)" /> |
| 1623 | } |
| 1624 |
+2
-2
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -346,11 +346,11 @@ | ||
| 346 | 346 | ){ |
| 347 | 347 | uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'"); |
| 348 | 348 | g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid); |
| 349 | 349 | zCap = "s"; |
| 350 | 350 | g.noPswd = 1; |
| 351 | - strcpy(g.zCsrfToken, "localhost"); | |
| 351 | + sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "localhost"); | |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /* Check the login cookie to see if it matches a known valid user. |
| 355 | 355 | */ |
| 356 | 356 | if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){ |
| @@ -411,11 +411,11 @@ | ||
| 411 | 411 | if( uid==0 ){ |
| 412 | 412 | /* If there is no user "nobody", then make one up - with no privileges */ |
| 413 | 413 | uid = -1; |
| 414 | 414 | zCap = ""; |
| 415 | 415 | } |
| 416 | - strcpy(g.zCsrfToken, "none"); | |
| 416 | + sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "none"); | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | /* At this point, we know that uid!=0. Find the privileges associated |
| 420 | 420 | ** with user uid. |
| 421 | 421 | */ |
| 422 | 422 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -346,11 +346,11 @@ | |
| 346 | ){ |
| 347 | uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'"); |
| 348 | g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid); |
| 349 | zCap = "s"; |
| 350 | g.noPswd = 1; |
| 351 | strcpy(g.zCsrfToken, "localhost"); |
| 352 | } |
| 353 | |
| 354 | /* Check the login cookie to see if it matches a known valid user. |
| 355 | */ |
| 356 | if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){ |
| @@ -411,11 +411,11 @@ | |
| 411 | if( uid==0 ){ |
| 412 | /* If there is no user "nobody", then make one up - with no privileges */ |
| 413 | uid = -1; |
| 414 | zCap = ""; |
| 415 | } |
| 416 | strcpy(g.zCsrfToken, "none"); |
| 417 | } |
| 418 | |
| 419 | /* At this point, we know that uid!=0. Find the privileges associated |
| 420 | ** with user uid. |
| 421 | */ |
| 422 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -346,11 +346,11 @@ | |
| 346 | ){ |
| 347 | uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'"); |
| 348 | g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid); |
| 349 | zCap = "s"; |
| 350 | g.noPswd = 1; |
| 351 | sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "localhost"); |
| 352 | } |
| 353 | |
| 354 | /* Check the login cookie to see if it matches a known valid user. |
| 355 | */ |
| 356 | if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){ |
| @@ -411,11 +411,11 @@ | |
| 411 | if( uid==0 ){ |
| 412 | /* If there is no user "nobody", then make one up - with no privileges */ |
| 413 | uid = -1; |
| 414 | zCap = ""; |
| 415 | } |
| 416 | sqlite3_snprintf(sizeof(g.zCsrfToken), g.zCsrfToken, "none"); |
| 417 | } |
| 418 | |
| 419 | /* At this point, we know that uid!=0. Find the privileges associated |
| 420 | ** with user uid. |
| 421 | */ |
| 422 |
+1
-1
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -44,11 +44,11 @@ | ||
| 44 | 44 | char *z; |
| 45 | 45 | int i; |
| 46 | 46 | |
| 47 | 47 | p = fossil_malloc( nPattern + sizeof(*p) + 1); |
| 48 | 48 | z = (char*)&p[1]; |
| 49 | - strcpy(z, zPattern); | |
| 49 | + memcpy(z, zPattern, nPattern+1); | |
| 50 | 50 | memset(p, 0, sizeof(*p)); |
| 51 | 51 | while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){ |
| 52 | 52 | while( !fossil_isalnum(*z) && *z ){ z++; } |
| 53 | 53 | if( *z==0 ) break; |
| 54 | 54 | p->a[p->nTerm].z = z; |
| 55 | 55 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -44,11 +44,11 @@ | |
| 44 | char *z; |
| 45 | int i; |
| 46 | |
| 47 | p = fossil_malloc( nPattern + sizeof(*p) + 1); |
| 48 | z = (char*)&p[1]; |
| 49 | strcpy(z, zPattern); |
| 50 | memset(p, 0, sizeof(*p)); |
| 51 | while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){ |
| 52 | while( !fossil_isalnum(*z) && *z ){ z++; } |
| 53 | if( *z==0 ) break; |
| 54 | p->a[p->nTerm].z = z; |
| 55 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -44,11 +44,11 @@ | |
| 44 | char *z; |
| 45 | int i; |
| 46 | |
| 47 | p = fossil_malloc( nPattern + sizeof(*p) + 1); |
| 48 | z = (char*)&p[1]; |
| 49 | memcpy(z, zPattern, nPattern+1); |
| 50 | memset(p, 0, sizeof(*p)); |
| 51 | while( *z && p->nTerm<sizeof(p->a)/sizeof(p->a[0]) ){ |
| 52 | while( !fossil_isalnum(*z) && *z ){ z++; } |
| 53 | if( *z==0 ) break; |
| 54 | p->a[p->nTerm].z = z; |
| 55 |
+2
-2
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -232,11 +232,11 @@ | ||
| 232 | 232 | if( strcmp(zType,"div")==0 ){ |
| 233 | 233 | @ <tr><td colspan="3"><hr /></td></tr> |
| 234 | 234 | continue; |
| 235 | 235 | } |
| 236 | 236 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 237 | - sprintf(zPrevDate, "%.10s", zDate); | |
| 237 | + sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); | |
| 238 | 238 | @ <tr><td> |
| 239 | 239 | @ <div class="divider">%s(zPrevDate)</div> |
| 240 | 240 | @ </td></tr> |
| 241 | 241 | } |
| 242 | 242 | memcpy(zTime, &zDate[11], 5); |
| @@ -1020,11 +1020,11 @@ | ||
| 1020 | 1020 | char *zFree = 0; |
| 1021 | 1021 | int n = 0; |
| 1022 | 1022 | char zPrefix[80]; |
| 1023 | 1023 | char zUuid[UUID_SIZE+1]; |
| 1024 | 1024 | |
| 1025 | - sprintf(zUuid, "%.10s", zId); | |
| 1025 | + sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId); | |
| 1026 | 1026 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 1027 | 1027 | printf("=== %.10s ===\n", zDate); |
| 1028 | 1028 | memcpy(zPrevDate, zDate, 10); |
| 1029 | 1029 | nLine++; |
| 1030 | 1030 | } |
| 1031 | 1031 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -232,11 +232,11 @@ | |
| 232 | if( strcmp(zType,"div")==0 ){ |
| 233 | @ <tr><td colspan="3"><hr /></td></tr> |
| 234 | continue; |
| 235 | } |
| 236 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 237 | sprintf(zPrevDate, "%.10s", zDate); |
| 238 | @ <tr><td> |
| 239 | @ <div class="divider">%s(zPrevDate)</div> |
| 240 | @ </td></tr> |
| 241 | } |
| 242 | memcpy(zTime, &zDate[11], 5); |
| @@ -1020,11 +1020,11 @@ | |
| 1020 | char *zFree = 0; |
| 1021 | int n = 0; |
| 1022 | char zPrefix[80]; |
| 1023 | char zUuid[UUID_SIZE+1]; |
| 1024 | |
| 1025 | sprintf(zUuid, "%.10s", zId); |
| 1026 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 1027 | printf("=== %.10s ===\n", zDate); |
| 1028 | memcpy(zPrevDate, zDate, 10); |
| 1029 | nLine++; |
| 1030 | } |
| 1031 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -232,11 +232,11 @@ | |
| 232 | if( strcmp(zType,"div")==0 ){ |
| 233 | @ <tr><td colspan="3"><hr /></td></tr> |
| 234 | continue; |
| 235 | } |
| 236 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 237 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 238 | @ <tr><td> |
| 239 | @ <div class="divider">%s(zPrevDate)</div> |
| 240 | @ </td></tr> |
| 241 | } |
| 242 | memcpy(zTime, &zDate[11], 5); |
| @@ -1020,11 +1020,11 @@ | |
| 1020 | char *zFree = 0; |
| 1021 | int n = 0; |
| 1022 | char zPrefix[80]; |
| 1023 | char zUuid[UUID_SIZE+1]; |
| 1024 | |
| 1025 | sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId); |
| 1026 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 1027 | printf("=== %.10s ===\n", zDate); |
| 1028 | memcpy(zPrevDate, zDate, 10); |
| 1029 | nLine++; |
| 1030 | } |
| 1031 |
+5
-5
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -61,11 +61,11 @@ | ||
| 61 | 61 | |
| 62 | 62 | sz = strlen(zUuid); |
| 63 | 63 | if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){ |
| 64 | 64 | return 0; |
| 65 | 65 | } |
| 66 | - strcpy(z, zUuid); | |
| 66 | + memcpy(z, zUuid, UUID_SIZE+1); | |
| 67 | 67 | canonical16(z, sz); |
| 68 | 68 | rid = fast_uuid_to_rid(z); |
| 69 | 69 | if( rid==0 && phantomize ){ |
| 70 | 70 | rid = content_new(zUuid); |
| 71 | 71 | } |
| @@ -366,11 +366,11 @@ | ||
| 366 | 366 | if( in==0 ){ |
| 367 | 367 | md5sum_step_text(" 0\n", -1); |
| 368 | 368 | continue; |
| 369 | 369 | } |
| 370 | 370 | fseek(in, 0L, SEEK_END); |
| 371 | - sprintf(zBuf, " %ld\n", ftell(in)); | |
| 371 | + sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", ftell(in)); | |
| 372 | 372 | fseek(in, 0L, SEEK_SET); |
| 373 | 373 | md5sum_step_text(zBuf, -1); |
| 374 | 374 | /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/ |
| 375 | 375 | for(;;){ |
| 376 | 376 | int n; |
| @@ -388,11 +388,11 @@ | ||
| 388 | 388 | if( zOrigName ) zName = zOrigName; |
| 389 | 389 | if( rid>0 ){ |
| 390 | 390 | md5sum_step_text(zName, -1); |
| 391 | 391 | blob_zero(&file); |
| 392 | 392 | content_get(rid, &file); |
| 393 | - sprintf(zBuf, " %d\n", blob_size(&file)); | |
| 393 | + sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file)); | |
| 394 | 394 | md5sum_step_text(zBuf, -1); |
| 395 | 395 | md5sum_step_blob(&file); |
| 396 | 396 | blob_reset(&file); |
| 397 | 397 | } |
| 398 | 398 | } |
| @@ -476,11 +476,11 @@ | ||
| 476 | 476 | int rid = db_column_int(&q, 2); |
| 477 | 477 | int isSelected = db_column_int(&q, 3); |
| 478 | 478 | if( zOrigName && !isSelected ) zName = zOrigName; |
| 479 | 479 | md5sum_step_text(zName, -1); |
| 480 | 480 | content_get(rid, &file); |
| 481 | - sprintf(zBuf, " %d\n", blob_size(&file)); | |
| 481 | + sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file)); | |
| 482 | 482 | md5sum_step_text(zBuf, -1); |
| 483 | 483 | /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/ |
| 484 | 484 | md5sum_step_blob(&file); |
| 485 | 485 | blob_reset(&file); |
| 486 | 486 | } |
| @@ -520,11 +520,11 @@ | ||
| 520 | 520 | manifest_file_rewind(pManifest); |
| 521 | 521 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 522 | 522 | fid = uuid_to_rid(pFile->zUuid, 0); |
| 523 | 523 | md5sum_step_text(pFile->zName, -1); |
| 524 | 524 | content_get(fid, &file); |
| 525 | - sprintf(zBuf, " %d\n", blob_size(&file)); | |
| 525 | + sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file)); | |
| 526 | 526 | md5sum_step_text(zBuf, -1); |
| 527 | 527 | md5sum_step_blob(&file); |
| 528 | 528 | blob_reset(&file); |
| 529 | 529 | } |
| 530 | 530 | if( pManOut ){ |
| 531 | 531 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -61,11 +61,11 @@ | |
| 61 | |
| 62 | sz = strlen(zUuid); |
| 63 | if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){ |
| 64 | return 0; |
| 65 | } |
| 66 | strcpy(z, zUuid); |
| 67 | canonical16(z, sz); |
| 68 | rid = fast_uuid_to_rid(z); |
| 69 | if( rid==0 && phantomize ){ |
| 70 | rid = content_new(zUuid); |
| 71 | } |
| @@ -366,11 +366,11 @@ | |
| 366 | if( in==0 ){ |
| 367 | md5sum_step_text(" 0\n", -1); |
| 368 | continue; |
| 369 | } |
| 370 | fseek(in, 0L, SEEK_END); |
| 371 | sprintf(zBuf, " %ld\n", ftell(in)); |
| 372 | fseek(in, 0L, SEEK_SET); |
| 373 | md5sum_step_text(zBuf, -1); |
| 374 | /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/ |
| 375 | for(;;){ |
| 376 | int n; |
| @@ -388,11 +388,11 @@ | |
| 388 | if( zOrigName ) zName = zOrigName; |
| 389 | if( rid>0 ){ |
| 390 | md5sum_step_text(zName, -1); |
| 391 | blob_zero(&file); |
| 392 | content_get(rid, &file); |
| 393 | sprintf(zBuf, " %d\n", blob_size(&file)); |
| 394 | md5sum_step_text(zBuf, -1); |
| 395 | md5sum_step_blob(&file); |
| 396 | blob_reset(&file); |
| 397 | } |
| 398 | } |
| @@ -476,11 +476,11 @@ | |
| 476 | int rid = db_column_int(&q, 2); |
| 477 | int isSelected = db_column_int(&q, 3); |
| 478 | if( zOrigName && !isSelected ) zName = zOrigName; |
| 479 | md5sum_step_text(zName, -1); |
| 480 | content_get(rid, &file); |
| 481 | sprintf(zBuf, " %d\n", blob_size(&file)); |
| 482 | md5sum_step_text(zBuf, -1); |
| 483 | /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/ |
| 484 | md5sum_step_blob(&file); |
| 485 | blob_reset(&file); |
| 486 | } |
| @@ -520,11 +520,11 @@ | |
| 520 | manifest_file_rewind(pManifest); |
| 521 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 522 | fid = uuid_to_rid(pFile->zUuid, 0); |
| 523 | md5sum_step_text(pFile->zName, -1); |
| 524 | content_get(fid, &file); |
| 525 | sprintf(zBuf, " %d\n", blob_size(&file)); |
| 526 | md5sum_step_text(zBuf, -1); |
| 527 | md5sum_step_blob(&file); |
| 528 | blob_reset(&file); |
| 529 | } |
| 530 | if( pManOut ){ |
| 531 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -61,11 +61,11 @@ | |
| 61 | |
| 62 | sz = strlen(zUuid); |
| 63 | if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){ |
| 64 | return 0; |
| 65 | } |
| 66 | memcpy(z, zUuid, UUID_SIZE+1); |
| 67 | canonical16(z, sz); |
| 68 | rid = fast_uuid_to_rid(z); |
| 69 | if( rid==0 && phantomize ){ |
| 70 | rid = content_new(zUuid); |
| 71 | } |
| @@ -366,11 +366,11 @@ | |
| 366 | if( in==0 ){ |
| 367 | md5sum_step_text(" 0\n", -1); |
| 368 | continue; |
| 369 | } |
| 370 | fseek(in, 0L, SEEK_END); |
| 371 | sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", ftell(in)); |
| 372 | fseek(in, 0L, SEEK_SET); |
| 373 | md5sum_step_text(zBuf, -1); |
| 374 | /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/ |
| 375 | for(;;){ |
| 376 | int n; |
| @@ -388,11 +388,11 @@ | |
| 388 | if( zOrigName ) zName = zOrigName; |
| 389 | if( rid>0 ){ |
| 390 | md5sum_step_text(zName, -1); |
| 391 | blob_zero(&file); |
| 392 | content_get(rid, &file); |
| 393 | sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file)); |
| 394 | md5sum_step_text(zBuf, -1); |
| 395 | md5sum_step_blob(&file); |
| 396 | blob_reset(&file); |
| 397 | } |
| 398 | } |
| @@ -476,11 +476,11 @@ | |
| 476 | int rid = db_column_int(&q, 2); |
| 477 | int isSelected = db_column_int(&q, 3); |
| 478 | if( zOrigName && !isSelected ) zName = zOrigName; |
| 479 | md5sum_step_text(zName, -1); |
| 480 | content_get(rid, &file); |
| 481 | sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file)); |
| 482 | md5sum_step_text(zBuf, -1); |
| 483 | /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/ |
| 484 | md5sum_step_blob(&file); |
| 485 | blob_reset(&file); |
| 486 | } |
| @@ -520,11 +520,11 @@ | |
| 520 | manifest_file_rewind(pManifest); |
| 521 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 522 | fid = uuid_to_rid(pFile->zUuid, 0); |
| 523 | md5sum_step_text(pFile->zName, -1); |
| 524 | content_get(fid, &file); |
| 525 | sqlite3_snprintf(sizeof(zBuf), zBuf, " %d\n", blob_size(&file)); |
| 526 | md5sum_step_text(zBuf, -1); |
| 527 | md5sum_step_blob(&file); |
| 528 | blob_reset(&file); |
| 529 | } |
| 530 | if( pManOut ){ |
| 531 |
+1
-1
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -1078,11 +1078,11 @@ | ||
| 1078 | 1078 | }else{ |
| 1079 | 1079 | blob_appendf(p->pOut, "[bad-link: %h]", zTarget); |
| 1080 | 1080 | zTerm = ""; |
| 1081 | 1081 | } |
| 1082 | 1082 | assert( strlen(zTerm)<nClose ); |
| 1083 | - strcpy(zClose, zTerm); | |
| 1083 | + sqlite3_snprintf(nClose, zClose, "%s", zTerm); | |
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | /* |
| 1087 | 1087 | ** Check to see if the given parsed markup is the correct |
| 1088 | 1088 | ** </verbatim> tag. |
| 1089 | 1089 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1078,11 +1078,11 @@ | |
| 1078 | }else{ |
| 1079 | blob_appendf(p->pOut, "[bad-link: %h]", zTarget); |
| 1080 | zTerm = ""; |
| 1081 | } |
| 1082 | assert( strlen(zTerm)<nClose ); |
| 1083 | strcpy(zClose, zTerm); |
| 1084 | } |
| 1085 | |
| 1086 | /* |
| 1087 | ** Check to see if the given parsed markup is the correct |
| 1088 | ** </verbatim> tag. |
| 1089 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1078,11 +1078,11 @@ | |
| 1078 | }else{ |
| 1079 | blob_appendf(p->pOut, "[bad-link: %h]", zTarget); |
| 1080 | zTerm = ""; |
| 1081 | } |
| 1082 | assert( strlen(zTerm)<nClose ); |
| 1083 | sqlite3_snprintf(nClose, zClose, "%s", zTerm); |
| 1084 | } |
| 1085 | |
| 1086 | /* |
| 1087 | ** Check to see if the given parsed markup is the correct |
| 1088 | ** </verbatim> tag. |
| 1089 |
+5
-3
| --- src/winhttp.c | ||
| +++ src/winhttp.c | ||
| @@ -71,12 +71,14 @@ | ||
| 71 | 71 | char zRequestFName[100]; |
| 72 | 72 | char zReplyFName[100]; |
| 73 | 73 | char zCmd[2000]; /* Command-line to process the request */ |
| 74 | 74 | char zHdr[2000]; /* The HTTP request header */ |
| 75 | 75 | |
| 76 | - sprintf(zRequestFName, "%s_in%d.txt", zTempPrefix, p->id); | |
| 77 | - sprintf(zReplyFName, "%s_out%d.txt", zTempPrefix, p->id); | |
| 76 | + sqlite3_snprintf(sizeof(zRequestFName), zRequestFName, | |
| 77 | + "%s_in%d.txt", zTempPrefix, p->id); | |
| 78 | + sqlite3_snprintf(sizeof(zReplyFName), zReplyFName, | |
| 79 | + "%s_out%d.txt", zTempPrefix, p->id); | |
| 78 | 80 | amt = 0; |
| 79 | 81 | while( amt<sizeof(zHdr) ){ |
| 80 | 82 | got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0); |
| 81 | 83 | if( got==SOCKET_ERROR ) goto end_request; |
| 82 | 84 | if( got==0 ){ |
| @@ -105,11 +107,11 @@ | ||
| 105 | 107 | } |
| 106 | 108 | wanted -= got; |
| 107 | 109 | } |
| 108 | 110 | fclose(out); |
| 109 | 111 | out = 0; |
| 110 | - sprintf(zCmd, "\"%s\" http \"%s\" %s %s %s%s", | |
| 112 | + sqlite3_snprintf(sizeof(zCmd), zCmd, "\"%s\" http \"%s\" %s %s %s%s", | |
| 111 | 113 | fossil_nameofexe(), g.zRepositoryName, zRequestFName, zReplyFName, |
| 112 | 114 | inet_ntoa(p->addr.sin_addr), p->zNotFound |
| 113 | 115 | ); |
| 114 | 116 | fossil_system(zCmd); |
| 115 | 117 | in = fopen(zReplyFName, "rb"); |
| 116 | 118 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -71,12 +71,14 @@ | |
| 71 | char zRequestFName[100]; |
| 72 | char zReplyFName[100]; |
| 73 | char zCmd[2000]; /* Command-line to process the request */ |
| 74 | char zHdr[2000]; /* The HTTP request header */ |
| 75 | |
| 76 | sprintf(zRequestFName, "%s_in%d.txt", zTempPrefix, p->id); |
| 77 | sprintf(zReplyFName, "%s_out%d.txt", zTempPrefix, p->id); |
| 78 | amt = 0; |
| 79 | while( amt<sizeof(zHdr) ){ |
| 80 | got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0); |
| 81 | if( got==SOCKET_ERROR ) goto end_request; |
| 82 | if( got==0 ){ |
| @@ -105,11 +107,11 @@ | |
| 105 | } |
| 106 | wanted -= got; |
| 107 | } |
| 108 | fclose(out); |
| 109 | out = 0; |
| 110 | sprintf(zCmd, "\"%s\" http \"%s\" %s %s %s%s", |
| 111 | fossil_nameofexe(), g.zRepositoryName, zRequestFName, zReplyFName, |
| 112 | inet_ntoa(p->addr.sin_addr), p->zNotFound |
| 113 | ); |
| 114 | fossil_system(zCmd); |
| 115 | in = fopen(zReplyFName, "rb"); |
| 116 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -71,12 +71,14 @@ | |
| 71 | char zRequestFName[100]; |
| 72 | char zReplyFName[100]; |
| 73 | char zCmd[2000]; /* Command-line to process the request */ |
| 74 | char zHdr[2000]; /* The HTTP request header */ |
| 75 | |
| 76 | sqlite3_snprintf(sizeof(zRequestFName), zRequestFName, |
| 77 | "%s_in%d.txt", zTempPrefix, p->id); |
| 78 | sqlite3_snprintf(sizeof(zReplyFName), zReplyFName, |
| 79 | "%s_out%d.txt", zTempPrefix, p->id); |
| 80 | amt = 0; |
| 81 | while( amt<sizeof(zHdr) ){ |
| 82 | got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0); |
| 83 | if( got==SOCKET_ERROR ) goto end_request; |
| 84 | if( got==0 ){ |
| @@ -105,11 +107,11 @@ | |
| 107 | } |
| 108 | wanted -= got; |
| 109 | } |
| 110 | fclose(out); |
| 111 | out = 0; |
| 112 | sqlite3_snprintf(sizeof(zCmd), zCmd, "\"%s\" http \"%s\" %s %s %s%s", |
| 113 | fossil_nameofexe(), g.zRepositoryName, zRequestFName, zReplyFName, |
| 114 | inet_ntoa(p->addr.sin_addr), p->zNotFound |
| 115 | ); |
| 116 | fossil_system(zCmd); |
| 117 | in = fopen(zReplyFName, "rb"); |
| 118 |