Skip to content

Commit 793c211

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a0feb86 commit 793c211

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

revision.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,9 +2112,8 @@ static int handle_revision_arg_1(const char *arg_, struct rev_info *revs, int fl
21122112
int exclude_parent = 1;
21132113

21142114
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)
21182117
return -1;
21192118
}
21202119

0 commit comments

Comments
 (0)