Fix comparison in s3fs_strtoofft

Also backfill unit tests.  Document limitations.  Found via
clang-tidy.
This commit is contained in:
Andrew Gaul
2019-01-17 22:32:32 -08:00
parent 25b49e1a2e
commit 5a2dc03a1c
3 changed files with 15 additions and 1 deletions

View File

@ -75,7 +75,7 @@ off_t s3fs_strtoofft(const char* str, bool is_base_16)
}
// check like isalnum and set data
result *= (is_base_16 ? 16 : 10);
if('0' <= *str || '9' < *str){
if('0' <= *str && '9' >= *str){
result += static_cast<off_t>(*str - '0');
}else if(is_base_16){
if('A' <= *str && *str <= 'F'){