Commit 5a6f31f2 by nulltoken

revparse: only allow decimal specifiers in carete and tilde synatx

    passing 0 to git_strol(32|64) let the implementation guess if it's
    dealing with an octal number or a decimal one.

    Let's make it safe and ensure that both 'HEAD@{010}' and 'HEAD@{10}'
    point at the same commit.
parent d1b7921a
...@@ -482,7 +482,7 @@ static int handle_caret_syntax(git_object **out, git_repository *repo, git_objec ...@@ -482,7 +482,7 @@ static int handle_caret_syntax(git_object **out, git_repository *repo, git_objec
if (movementlen == 0) { if (movementlen == 0) {
n = 1; n = 1;
} else { } else {
git__strtol32(&n, movement, NULL, 0); git__strtol32(&n, movement, NULL, 10);
} }
commit = (git_commit*)obj; commit = (git_commit*)obj;
...@@ -513,7 +513,7 @@ static int handle_linear_syntax(git_object **out, git_object *obj, const char *m ...@@ -513,7 +513,7 @@ static int handle_linear_syntax(git_object **out, git_object *obj, const char *m
/* "~" is the same as "~1" */ /* "~" is the same as "~1" */
if (*movement == '\0') { if (*movement == '\0') {
n = 1; n = 1;
} else if (git__strtol32(&n, movement, NULL, 0) < 0) { } else if (git__strtol32(&n, movement, NULL, 10) < 0) {
return GIT_ERROR; return GIT_ERROR;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment