revision: use strtol_i() for exclude_parent

Avoid silent overflow of the int exclude_parent by using the appropriate function, strtol_i(), to parse its value. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Oct 1, 2022 at 12:25 UTC 793c21182e34f109b4f438944b4272fb50862ad5
1 file changed +2 -3
revision.c
+2 -3
@@ -2112,9 +2112,8 @@ static int handle_revision_arg_1(const char *arg_, struct rev_info *revs, int fl
2112 int exclude_parent = 1;
2113
2114 if (mark[2]) {
2115 - char *end;
2116 - exclude_parent = strtoul(mark + 2, &end, 10);
2117 - if (*end != '\0' || !exclude_parent)
2115 + if (strtol_i(mark + 2, 10, &exclude_parent) ||
2116 + exclude_parent < 1)
2117 return -1;
2118 }
2119