Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2022-10-01 13:25:36 +0300
committerJunio C Hamano <gitster@pobox.com>2022-10-02 01:58:33 +0300
commit793c21182e34f109b4f438944b4272fb50862ad5 (patch)
tree2754ee33896694e55fde9311932786e30a9c1dec /revision.c
parenta0feb8611d4c0b2b5d954efe4e98207f62223436 (diff)
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>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/revision.c b/revision.c
index 0c6e26cd9c..da9dfd405e 100644
--- a/revision.c
+++ b/revision.c
@@ -2112,9 +2112,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;
}