diff --git a/include/private/soci-cstrtoi.h b/include/private/soci-cstrtoi.h index 2d507f7a..ca28756e 100644 --- a/include/private/soci-cstrtoi.h +++ b/include/private/soci-cstrtoi.h @@ -10,6 +10,7 @@ #include "soci/error.h" +#include #include #include @@ -30,7 +31,7 @@ bool cstring_to_integer(T& result, char const* buf) char * end; const long long t = strtoll(buf, &end, 10); - if (end == buf || *end != '\0') + if (end == buf || *end != '\0' || errno == ERANGE) return false; // successfully converted to long long @@ -53,7 +54,7 @@ bool cstring_to_unsigned(T& result, char const* buf) char * end; const unsigned long long t = strtoull(buf, &end, 10); - if (end == buf || *end != '\0') + if (end == buf || *end != '\0' || errno == ERANGE) return false; // successfully converted to unsigned long long