[PATCH] avoid off-by-one error in run_upload_archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Jochen Voss <voss@xxxxxxxxxx>
---
 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux