Fossil SCM

Do not attempt to parse control artifacts that do not end with a '\n' character. Ticket [be56c89def7f86bcbd]

drh 2010-10-16 16:24 trunk
Commit 7954ccba68bd84f9afb1cbef84a8544c31accf38
1 file changed +8
--- src/manifest.c
+++ src/manifest.c
@@ -201,10 +201,18 @@
201201
int seenHeader = 0;
202202
int seenZ = 0;
203203
int i, lineNo=0;
204204
Blob line, token, a1, a2, a3, a4;
205205
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
+ }
206214
207215
memset(p, 0, sizeof(*p));
208216
memcpy(&p->content, pContent, sizeof(p->content));
209217
blob_zero(pContent);
210218
pContent = &p->content;
211219
--- 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

Keyboard Shortcuts

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