threads / patch / 29290

patchCatch invalid --depth option passed to clone or fetch

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

## tl;dr

2 messages between Jan 4, 2012 and Jan 4, 2012. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Nguyễn Thái Ngọc Duy· Jan 4, 2012, 10:01 UTC · lore
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 transport.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
Show changes to transport.c +6 −2
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

← back to recent threads