Browse Source

avoid off-by-one error in run_upload_archive

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>
maint
Jochen Voss 17 years ago committed by Junio C Hamano
parent
commit
74d817cf8c
  1. 2
      builtin-upload-archive.c

2
builtin-upload-archive.c

@ -30,7 +30,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix) @@ -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 */

Loading…
Cancel
Save