From f4f6eb592380523ce31b2a7fe2beab03837e589d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 18 Oct 2018 11:58:14 +0200 Subject: global: replace remaining use of `git__strtol32` Replace remaining uses of the `git__strtol32` function. While these uses are all safe as the strings were either sanitized or from a trusted source, we want to remove `git__strtol32` altogether to avoid future misuse. (cherry picked from commit 2613fbb26a3e1a34dda8a5d198c108626cfd6cc3) --- src/revparse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/revparse.c') diff --git a/src/revparse.c b/src/revparse.c index fd6bd1ea6..927e83073 100644 --- a/src/revparse.c +++ b/src/revparse.c @@ -127,7 +127,8 @@ static int try_parse_numeric(int *n, const char *curly_braces_content) int32_t content; const char *end_ptr; - if (git__strtol32(&content, curly_braces_content, &end_ptr, 10) < 0) + if (git__strntol32(&content, curly_braces_content, strlen(curly_braces_content), + &end_ptr, 10) < 0) return -1; if (*end_ptr != '\0') @@ -577,7 +578,7 @@ static int extract_how_many(int *n, const char *spec, size_t *pos) } while (spec[(*pos)] == kind && kind == '~'); if (git__isdigit(spec[*pos])) { - if (git__strtol32(&parsed, spec + *pos, &end_ptr, 10) < 0) + if (git__strntol32(&parsed, spec + *pos, strlen(spec + *pos), &end_ptr, 10) < 0) return GIT_EINVALIDSPEC; accumulated += (parsed - 1); -- cgit v1.2.1