git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Catch invalid --depth option passed to clone or fetch
@ 2012-01-04 10:01 Nguyễn Thái Ngọc Duy
  2012-01-04 17:43 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-01-04 10:01 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Catch invalid --depth option passed to clone or fetch
  2012-01-04 10:01 [PATCH] Catch invalid --depth option passed to clone or fetch Nguyễn Thái Ngọc Duy
@ 2012-01-04 17:43 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2012-01-04 17:43 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-04 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04 10:01 [PATCH] Catch invalid --depth option passed to clone or fetch Nguyễn Thái Ngọc Duy
2012-01-04 17:43 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).