From: René Scharfe Date: Sat, 01 Oct 2022 10:25:36 GMT Subject: [PATCH v3 1/3] revision: use strtol_i() for exclude_parent Message-ID: <4fc4cf3b-a658-3959-4541-b889534fbbb0@web.de> In-Reply-To: <16c49d20-cafc-4b48-3c6b-e11c74c29abb@web.de> Avoid silent overflow of the int exclude_parent by using the appropriate function, strtol_i(), to parse its value. Signed-off-by: René Scharfe --- revision.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/revision.c b/revision.c index 36e31942ce..79b88604c7 100644 --- a/revision.c +++ b/revision.c @@ -2120,9 +2120,8 @@ static int handle_revision_arg_1(const char *arg_, struct rev_info *revs, int fl int exclude_parent = 1; if (mark[2]) { - char *end; - exclude_parent = strtoul(mark + 2, &end, 10); - if (*end != '\0' || !exclude_parent) + if (strtol_i(mark + 2, 10, &exclude_parent) || + exclude_parent < 1) return -1; } -- 2.37.3