From: John Hodge Date: Sat, 10 May 2014 09:17:46 +0000 (+0800) Subject: Usermode/libc - Actually fix strtoi (passing utest now) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=e419521fb536d8d8811ba5f03ee30834a6c13c87;p=tpg%2Facess2.git Usermode/libc - Actually fix strtoi (passing utest now) --- diff --git a/Usermode/Libraries/libc.so_src/strtoi.c b/Usermode/Libraries/libc.so_src/strtoi.c index 9864fd57..84bf0005 100644 --- a/Usermode/Libraries/libc.so_src/strtoi.c +++ b/Usermode/Libraries/libc.so_src/strtoi.c @@ -138,7 +138,8 @@ long long strtoll(const char *str, char **end, int base) //_SysDebug("strtoll - neg=%i,ret=%llu", neg, ret); if( neg ) { - if( ret + LLONG_MIN > 0 ) { + // Abuses unsigned integer overflow + if( ret + LLONG_MIN < ret ) { errno = ERANGE; return LLONG_MIN; }