diff options
author | Krishna Ram Prakash R <krp@gtux.in> | 2016-06-28 20:19:52 +0530 |
---|---|---|
committer | Krishna Ram Prakash R <krp@gtux.in> | 2016-06-29 13:32:18 +0530 |
commit | 70b9b8417910c97307e1c5dd5886ce76e68e201c (patch) | |
tree | 952bfc2ea686ff2531416719dd3feca6579996ff /src/util.c | |
parent | 20302aa43738a972e0bd2e2ee6ae479208427b31 (diff) | |
download | libgit2-70b9b8417910c97307e1c5dd5886ce76e68e201c.tar.gz |
Fixed bug while parsing INT64_MIN
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c index 3090c7437..e9cccea20 100644 --- a/src/util.c +++ b/src/util.c @@ -128,8 +128,8 @@ int git__strntol64(int64_t *result, const char *nptr, size_t nptr_len, const cha v = c - 'A' + 10; if (v >= base) break; - nn = n*base + v; - if (nn < n) + nn = n * base + (neg ? -v : v); + if ((!neg && nn < n) || (neg && nn > n)) ovfl = 1; n = nn; } @@ -148,7 +148,7 @@ Return: return -1; } - *result = neg ? -n : n; + *result = n; return 0; } |