Re: [PATCH] Fix git_mkstemp to return an error when path is too long.

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

 



Hi,

On Thu, 26 Jul 2007, Carlos Rica wrote:

> @@ -79,12 +80,14 @@ int git_mkstemp(char *path, size_t len, const char *template)
>  		pch += 5;
>  	} else {
>  		size_t n = snprintf(pch, len, "%s/", env);
> -
> +		if (n >= len)
> +			return -2;

That is certainly a bug fixed (even if few people have an insanely long 
TMPDIR...)

>  		len -= n;
>  		pch += n;
>  	}
> 
> -	strlcpy(pch, template, len);
> +	if (strlcpy(pch, template, len) >= len)
> +		return -2;

Maybe just "return error("filename too long: %.*s", 60, pch);"?  So that 
all callers to git_mkstemp() get the message for free?


Ciao,
Dscho

-
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]

  Powered by Linux