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().

dmestas 2026-11-14 06:52 UTC small-fixes-2
Commit fbc0065c42a80a6acec6a38b74e11d67a7ff129b9cd5cd35321bc7eaa4832508
1 file changed +4 -1
+4 -1
--- src/manifest.c
+++ src/manifest.c
@@ -381,11 +381,14 @@
381381
** Return NULL if there are no more tokens on the current line.
382382
*/
383383
static char *next_token(ManifestText *p, int *pLen){
384384
char *zStart;
385385
int n;
386
- if( p->atEol ) return 0;
386
+ if( p->atEol ){
387
+ if( pLen ) *pLen = 0;
388
+ return 0;
389
+ }
387390
zStart = p->z;
388391
n = strcspn(p->z, " \n");
389392
p->atEol = p->z[n]=='\n';
390393
p->z[n] = 0;
391394
p->z += n+1;
392395
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button