| | @@ -141,11 +141,11 @@ |
| 141 | 141 | */ |
| 142 | 142 | int manifest_parse(Manifest *p, Blob *pContent){ |
| 143 | 143 | int seenHeader = 0; |
| 144 | 144 | int seenZ = 0; |
| 145 | 145 | int i, lineNo=0; |
| 146 | | - Blob line, token, a1, a2, a3; |
| 146 | + Blob line, token, a1, a2, a3, a4; |
| 147 | 147 | char cPrevType = 0; |
| 148 | 148 | |
| 149 | 149 | memset(p, 0, sizeof(*p)); |
| 150 | 150 | memcpy(&p->content, pContent, sizeof(p->content)); |
| 151 | 151 | blob_zero(pContent); |
| | @@ -272,18 +272,18 @@ |
| 272 | 272 | } |
| 273 | 273 | break; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /* |
| 277 | | - ** F <filename> <uuid> ?<permissions>? |
| 277 | + ** F <filename> <uuid> ?<permissions>? ?<old-name>? |
| 278 | 278 | ** |
| 279 | 279 | ** Identifies a file in a manifest. Multiple F lines are |
| 280 | 280 | ** allowed in a manifest. F lines are not allowed in any |
| 281 | | - ** other control file. The filename is fossil-encoded. |
| 281 | + ** other control file. The filename and old-name are fossil-encoded. |
| 282 | 282 | */ |
| 283 | 283 | case 'F': { |
| 284 | | - char *zName, *zUuid, *zPerm; |
| 284 | + char *zName, *zUuid, *zPerm, *zPriorName; |
| 285 | 285 | md5sum_step_text(blob_buffer(&line), blob_size(&line)); |
| 286 | 286 | if( blob_token(&line, &a1)==0 ) goto manifest_syntax_error; |
| 287 | 287 | if( blob_token(&line, &a2)==0 ) goto manifest_syntax_error; |
| 288 | 288 | zName = blob_terminate(&a1); |
| 289 | 289 | zUuid = blob_terminate(&a2); |
| | @@ -292,10 +292,18 @@ |
| 292 | 292 | if( blob_size(&a2)!=UUID_SIZE ) goto manifest_syntax_error; |
| 293 | 293 | if( !validate16(zUuid, UUID_SIZE) ) goto manifest_syntax_error; |
| 294 | 294 | defossilize(zName); |
| 295 | 295 | if( !file_is_simple_pathname(zName) ){ |
| 296 | 296 | goto manifest_syntax_error; |
| 297 | + } |
| 298 | + blob_token(&line, &a4); |
| 299 | + zPriorName = blob_terminate(&a4); |
| 300 | + if( zPriorName[0] ){ |
| 301 | + defossilize(zPriorName); |
| 302 | + if( !file_is_simple_pathname(zPriorName) ){ |
| 303 | + goto manifest_syntax_error; |
| 304 | + } |
| 297 | 305 | } |
| 298 | 306 | if( p->nFile>=p->nFileAlloc ){ |
| 299 | 307 | p->nFileAlloc = p->nFileAlloc*2 + 10; |
| 300 | 308 | p->aFile = realloc(p->aFile, p->nFileAlloc*sizeof(p->aFile[0]) ); |
| 301 | 309 | if( p->aFile==0 ) fossil_panic("out of memory"); |
| 302 | 310 | |