aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2015-11-15 21:03:45 +0000
committerMartin Pärtel <martin.partel@gmail.com>2015-11-15 21:03:45 +0000
commitfd6663ef973e708d6f59a757902413f9c257cefc (patch)
tree4818b76f5c6bf081ffb654569f05671137835f3b
parent61fd3a4ed41d7c0b148ea64fb9f07b7f55372c69 (diff)
downloadbindfs-fd6663ef973e708d6f59a757902413f9c257cefc.tar.gz
Fix overflow in parse_byte_count when "long" is 32-bit.
-rw-r--r--src/misc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/misc.c b/src/misc.c
index 4442127..612ec82 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -125,7 +125,7 @@ int parse_byte_count(const char *str, double *result)
{
char* end;
double base = strtod(str, &end);
- long mul = 1;
+ long long mul = 1;
if (*end == '\0') {
mul = 1L;
} else if (strcmp(end, "k") == 0) {
@@ -135,7 +135,7 @@ int parse_byte_count(const char *str, double *result)
} else if (strcmp(end, "G") == 0) {
mul = 1024L * 1024L * 1024L;
} else if (strcmp(end, "T") == 0) {
- mul = 1024L * 1024L * 1024L * 1024L;
+ mul = 1024LL * 1024LL * 1024LL * 1024LL;
} else {
return 0;
}