Fossil SCM
Do not attempt to parse control artifacts that do not end with a '\n' character. Ticket [be56c89def7f86bcbd]
Commit
7954ccba68bd84f9afb1cbef84a8544c31accf38
Parent
ddb975e2be4c133…
1 file changed
+8
+8
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -201,10 +201,18 @@ | ||
| 201 | 201 | int seenHeader = 0; |
| 202 | 202 | int seenZ = 0; |
| 203 | 203 | int i, lineNo=0; |
| 204 | 204 | Blob line, token, a1, a2, a3, a4; |
| 205 | 205 | char cPrevType = 0; |
| 206 | + | |
| 207 | + /* Every control artifact ends with a '\n' character. Exit early | |
| 208 | + ** if that is not the case for this artifact. */ | |
| 209 | + i = blob_size(pContent); | |
| 210 | + if( i<=0 || blob_buffer(pContent)[i-1]!='\n' ){ | |
| 211 | + blob_reset(pContent); | |
| 212 | + return 0; | |
| 213 | + } | |
| 206 | 214 | |
| 207 | 215 | memset(p, 0, sizeof(*p)); |
| 208 | 216 | memcpy(&p->content, pContent, sizeof(p->content)); |
| 209 | 217 | blob_zero(pContent); |
| 210 | 218 | pContent = &p->content; |
| 211 | 219 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -201,10 +201,18 @@ | |
| 201 | int seenHeader = 0; |
| 202 | int seenZ = 0; |
| 203 | int i, lineNo=0; |
| 204 | Blob line, token, a1, a2, a3, a4; |
| 205 | char cPrevType = 0; |
| 206 | |
| 207 | memset(p, 0, sizeof(*p)); |
| 208 | memcpy(&p->content, pContent, sizeof(p->content)); |
| 209 | blob_zero(pContent); |
| 210 | pContent = &p->content; |
| 211 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -201,10 +201,18 @@ | |
| 201 | int seenHeader = 0; |
| 202 | int seenZ = 0; |
| 203 | int i, lineNo=0; |
| 204 | Blob line, token, a1, a2, a3, a4; |
| 205 | char cPrevType = 0; |
| 206 | |
| 207 | /* Every control artifact ends with a '\n' character. Exit early |
| 208 | ** if that is not the case for this artifact. */ |
| 209 | i = blob_size(pContent); |
| 210 | if( i<=0 || blob_buffer(pContent)[i-1]!='\n' ){ |
| 211 | blob_reset(pContent); |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | memset(p, 0, sizeof(*p)); |
| 216 | memcpy(&p->content, pContent, sizeof(p->content)); |
| 217 | blob_zero(pContent); |
| 218 | pContent = &p->content; |
| 219 |