{"thread":{"id":"14202","subject":"[PATCH] avoid off-by-one error in run_upload_archive","startedAt":"2008-06-28T16:04:24Z","lastAt":"2008-06-28T16:04:24Z","messageCount":1,"participants":["Jochen Voss"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"81566","messageId":"20080628160424.GA27915@seehuhn.de","threadId":"14202","inReplyTo":null,"subject":"[PATCH] avoid off-by-one error in run_upload_archive","fromName":"Jochen Voss","fromEmail":"voss@seehuhn.de","sentAt":"2008-06-28T16:04:24Z","receivedAt":"2008-06-28T16:04:24Z","isPatch":true,"sender":{"key":"voss@seehuhn.de","avatar":null},"body":"Make sure that buf has enough space to store the trailing \\0 of\nthe command line argument, too.\n\nSigned-off-by: Jochen Voss <voss@seehuhn.de>\n---\n builtin-upload-archive.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-upload-archive.c b/builtin-upload-archive.c\nindex 48ae09e..371400d 100644\n--- a/builtin-upload-archive.c\n+++ b/builtin-upload-archive.c\n@@ -30,7 +30,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)\n \tif (argc != 2)\n \t\tusage(upload_archive_usage);\n \n-\tif (strlen(argv[1]) > sizeof(buf))\n+\tif (strlen(argv[1]) + 1 > sizeof(buf))\n \t\tdie(\"insanely long repository name\");\n \n \tstrcpy(buf, argv[1]); /* enter-repo smudges its argument */\n-- \n1.5.3.7\n"}]}