git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Catch invalid --depth option passed to clone or fetch

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jan 4, 2012, 10:01 UTC
Message-ID
<1325671315-24931-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 transport.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/transport.c b/transport.c
index 51814b5..8a13f43 100644
--- a/transport.c
+++ b/transport.c
@@ -474,8 +474,12 @@ static int set_git_option(struct git_transport_options *opts,
 	} else if (!strcmp(name, TRANS_OPT_DEPTH)) {
 		if (!value)
 			opts->depth = 0;
-		else
-			opts->depth = atoi(value);
+		else {
+			char *end;
+			opts->depth = strtol(value, &end, 0);
+			if (*end)
+				die("transport: invalid depth option '%s'", value);
+		}
 		return 0;
 	}
 	return 1;
-- 
1.7.3.1.256.g2539c.dirty
Next: Junio C Hamano
Message 1 of 2 in “Catch invalid --depth option passed to clone or fetch”
  1. Catch invalid --depth option passed to clone or fetchNguyễn Thái Ngọc Duy, Jan 4, 2012
  2. Junio C HamanoJan 4, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.