Git development
 help / color / mirror / Atom feed
From: Jochen Voss <voss@seehuhn.de>
To: git@vger.kernel.org
Cc: gitster@pobox.com
Subject: [PATCH] avoid off-by-one error in run_upload_archive
Date: Sat, 28 Jun 2008 17:04:24 +0100	[thread overview]
Message-ID: <20080628160424.GA27915@seehuhn.de> (raw)

Make sure that buf has enough space to store the trailing \0 of
the command line argument, too.

Signed-off-by: Jochen Voss <voss@seehuhn.de>
---
 builtin-upload-archive.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index 48ae09e..371400d 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -30,7 +30,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
 	if (argc != 2)
 		usage(upload_archive_usage);
 
-	if (strlen(argv[1]) > sizeof(buf))
+	if (strlen(argv[1]) + 1 > sizeof(buf))
 		die("insanely long repository name");
 
 	strcpy(buf, argv[1]); /* enter-repo smudges its argument */
-- 
1.5.3.7

                 reply	other threads:[~2008-06-28 16:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080628160424.GA27915@seehuhn.de \
    --to=voss@seehuhn.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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