Fossil SCM
In next_token(), set the length to zero when there is no token. A K-card or Z-card with no argument kept the length of a token from an earlier card, passed its check on that length, and gave validate16() a null pointer, which crashed manifest_parse().
Commit
fbc0065c42a80a6acec6a38b74e11d67a7ff129b9cd5cd35321bc7eaa4832508
Parent
da1ce17a27a7364…
1 file changed
+4
-1
+4
-1
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -381,11 +381,14 @@ | ||
| 381 | 381 | ** Return NULL if there are no more tokens on the current line. |
| 382 | 382 | */ |
| 383 | 383 | static char *next_token(ManifestText *p, int *pLen){ |
| 384 | 384 | char *zStart; |
| 385 | 385 | int n; |
| 386 | - if( p->atEol ) return 0; | |
| 386 | + if( p->atEol ){ | |
| 387 | + if( pLen ) *pLen = 0; | |
| 388 | + return 0; | |
| 389 | + } | |
| 387 | 390 | zStart = p->z; |
| 388 | 391 | n = strcspn(p->z, " \n"); |
| 389 | 392 | p->atEol = p->z[n]=='\n'; |
| 390 | 393 | p->z[n] = 0; |
| 391 | 394 | p->z += n+1; |
| 392 | 395 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -381,11 +381,14 @@ | |
| 381 | ** Return NULL if there are no more tokens on the current line. |
| 382 | */ |
| 383 | static char *next_token(ManifestText *p, int *pLen){ |
| 384 | char *zStart; |
| 385 | int n; |
| 386 | if( p->atEol ) return 0; |
| 387 | zStart = p->z; |
| 388 | n = strcspn(p->z, " \n"); |
| 389 | p->atEol = p->z[n]=='\n'; |
| 390 | p->z[n] = 0; |
| 391 | p->z += n+1; |
| 392 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -381,11 +381,14 @@ | |
| 381 | ** Return NULL if there are no more tokens on the current line. |
| 382 | */ |
| 383 | static char *next_token(ManifestText *p, int *pLen){ |
| 384 | char *zStart; |
| 385 | int n; |
| 386 | if( p->atEol ){ |
| 387 | if( pLen ) *pLen = 0; |
| 388 | return 0; |
| 389 | } |
| 390 | zStart = p->z; |
| 391 | n = strcspn(p->z, " \n"); |
| 392 | p->atEol = p->z[n]=='\n'; |
| 393 | p->z[n] = 0; |
| 394 | p->z += n+1; |
| 395 |