git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Carlos Rica <jasampler@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] Fix git_mkstemp to return an error when path is too long.
Date: Thu, 26 Jul 2007 04:36:27 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0707260433280.14781@racer.site> (raw)
In-Reply-To: <46A7F9C4.7030004@gmail.com>

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

  reply	other threads:[~2007-07-26  3:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26  1:32 [PATCH] Fix git_mkstemp to return an error when path is too long Carlos Rica
2007-07-26  3:36 ` Johannes Schindelin [this message]
2007-07-26  4:26 ` Junio C Hamano
2007-07-26 19:42   ` Carlos Rica

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0707260433280.14781@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jasampler@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).