Re: [PATCH 2/7 (v5)] basic api and porcelain
- From
Julian Phillips <julian@quantumfyre.co.uk>
- Date
- Apr 6, 2010, 19:25 UTC
- Message-ID
- <dbe35e7547614331d19b811c180731aa@212.159.54.234>
- In-Reply-To
- <4BBA40CD.5040301@gmail.com>
On Mon, 05 Apr 2010 20:58:05 +0100, Nick Edelen <sirnot@gmail.com> 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.
Show 11 quoted lines
> +/* 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;
> +};Show 12 quoted lines
> +/* 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