Re: [PATCH 1/2] sha1_file: Add sha1_object_type_literally and export it.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2015-02-25 at 16:37 +0530, Karthik Nayak wrote:
> +	unsigned long mapsize;
> ...
> +	map = map_sha1_file(sha1, &mapsize);

I know this is a pre-existing issue, but I'm not sure "unsigned long" is
the right type here.  Shouldn't it be a size_t?  

> +	if (!map)
> +		return -1;
> +	if (unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr)) < 0)
> +		status = error("unable to unpack %s header",
> +			       sha1_to_hex(sha1));
> +
> +	for (i = 0; i < 32; i++) {

This number should probably be a constant.

> +		if (hdr[i] == ' ') {
> +			type[i] = '\0';
> +			break;
> +		}
> +		type[i] = hdr[i];
> +	}

type might end up without a trailing \0 here in the case where hdr has
no space in it.  Is this possible?


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]