summaryrefslogtreecommitdiff
path: root/src/revparse.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-10-18 11:58:14 +0200
committerPatrick Steinhardt <ps@pks.im>2018-10-18 11:58:14 +0200
commit2613fbb26a3e1a34dda8a5d198c108626cfd6cc3 (patch)
tree968df61bb825f5d2efc70c1fb2734b42df115732 /src/revparse.c
parent21652ee9de439e042cc2e69b208aa2ef8ce31147 (diff)
downloadlibgit2-2613fbb26a3e1a34dda8a5d198c108626cfd6cc3.tar.gz
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.
Diffstat (limited to 'src/revparse.c')
-rw-r--r--src/revparse.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/revparse.c b/src/revparse.c
index bdbf87558..df96f9d86 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -128,7 +128,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')
@@ -578,7 +579,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);