Check-in [1871a93dd4]
Not logged in
Overview

SHA1 Hash:1871a93dd4908cb547189d8c6cda978a82bfcdb6
Date: 2007-08-30 18:05:19
User: drh
Comment:Fix bugs that can cause a segfault if a blank check-in comment is entered.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/checkin.c from [24fdcaa11c] to [670906c45d].

@@ -392,10 +392,13 @@
   }
   db_finalize(&q);
 
   /* Create the manifest */
   blob_zero(&manifest);
+  if( blob_size(&comment)==0 ){
+    blob_append(&comment, "(no comment)", -1);
+  }
   blob_appendf(&manifest, "C %F\n", blob_str(&comment));
   zDate = db_text(0, "SELECT datetime('now')");
   zDate[10] = 'T';
   blob_appendf(&manifest, "D %s\n", zDate);
   db_prepare(&q,

Modified src/vfile.c from [aea4942364] to [5ad913c384].

@@ -384,15 +384,18 @@
   int i, fid;
   Blob file, mfile;
   Manifest m;
   char zBuf[100];
 
+  blob_zero(pOut);
+  if( pManOut ){
+    blob_zero(pManOut);
+  }
   db_must_be_within_tree();
   content_get(vid, &mfile);
   if( manifest_parse(&m, &mfile)==0 ){
-    blob_zero(pOut);
-    return;
+    fossil_panic("manifest file (%d) is malformed", vid);
   }
   for(i=0; i<m.nFile; i++){
     fid = uuid_to_rid(m.aFile[i].zUuid, 0);
     md5sum_step_text(m.aFile[i].zName, -1);
     content_get(fid, &file);
@@ -400,11 +403,10 @@
     md5sum_step_text(zBuf, -1);
     md5sum_step_blob(&file);
     blob_reset(&file);
   }
   if( pManOut ){
-    blob_zero(pManOut);
     blob_append(pManOut, m.zRepoCksum, -1);
   }
   manifest_clear(&m);
   md5sum_finish(pOut);
 }