Re: [PATCH 2/7 (v5)] basic api and porcelain
From: Julian Phillips <hidden>
Date: 2016-06-15 22:48:34
On Mon, 05 Apr 2010 20:58:05 +0100, Nick Edelen [off-list ref] wrote:
+ /* initialize header */ + strcpy(head.signature, "REVCACHE");
head.signature is 8 characters (see below), and so is "REVCACHE". Surely either head.signature needs to be 9 characters, or you shouldn't use strcpy. Indeed, mostly you do seem to be using memcpy ... This is in a couple of other places too, with both rc_index_header, and rc_slice_header.
+/* single index maps objects to cache files */
+struct rc_index_header {
+ char signature[8]; /* REVINDEX */
+ unsigned char version;
+ uint32_t ofs_objects;
+
+ uint32_t object_nr;
+ unsigned char cache_nr;
+
+ uint32_t max_date;
+};+/* structure for actual cache file */
+struct rc_slice_header {
+ char signature[8]; /* REVCACHE */
+ unsigned char version;
+ uint32_t ofs_objects;
+
+ uint32_t object_nr;
+ uint16_t path_nr;
+ uint32_t size;
+
+ unsigned char sha1[20];
+};-- Julian