]> git.ipfire.org Git - thirdparty/git.git/commitdiff
avoid off-by-one error in run_upload_archive
authorJochen Voss <voss@seehuhn.de>
Sat, 28 Jun 2008 16:04:24 +0000 (17:04 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 28 Jun 2008 20:43:21 +0000 (13:43 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-upload-archive.c

index 48ae09e9b5268ce1f11cfba433680a147ca39f7e..371400d49a5ff9f6ce297d7af07eb3fd6426c9ee 100644 (file)
@@ -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 */