Skip to content

Commit

Permalink
avoid off-by-one error in run_upload_archive
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jochen Voss authored and Junio C Hamano committed Jun 28, 2008
1 parent 7ac749c commit 74d817c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-upload-archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 74d817c

Please sign in to comment.