strtoull() might return '-1' to signify an overflow.
Signed-off-by: Hannes Reinecke <[email protected]>
---
hw/core/qdev-properties.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index dc8ae69..5761295 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -202,6 +202,9 @@ static int parse_hex8(DeviceState *dev, Property *prop,
const char *str)
if ((*end != '\0') || (end == str)) {
return -EINVAL;
}
+ if (*ptr == (uint8_t)-1) {
+ return -ERANGE;
+ }
return 0;
}
@@ -333,6 +336,9 @@ static int parse_hex32(DeviceState *dev, Property *prop,
const char *str)
if ((*end != '\0') || (end == str)) {
return -EINVAL;
}
+ if (*ptr == (uint32_t)-1) {
+ return -ERANGE;
+ }
return 0;
}
@@ -400,6 +406,9 @@ static int parse_hex64(DeviceState *dev, Property *prop,
const char *str)
if ((*end != '\0') || (end == str)) {
return -EINVAL;
}
+ if (*ptr == (uint64_t)-1) {
+ return -ERANGE;
+ }
return 0;
}
--
1.8.1.4