summaryrefslogtreecommitdiffhomepage
path: root/dbutil.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2013-11-25 23:08:33 +0800
committerMatt Johnston <matt@ucc.asn.au>2013-11-25 23:08:33 +0800
commitc5e36f8e3cd390b77ce43f58f01b3d3a9111d989 (patch)
tree0924f43a4cf93bd6211e36117441165fdfb71e75 /dbutil.c
parent5a85c4b91b8f602f325fbdea2adc697c50c1630f (diff)
Fix some warnings
Diffstat (limited to 'dbutil.c')
-rw-r--r--dbutil.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/dbutil.c b/dbutil.c
index b194e3d..ce88731 100644
--- a/dbutil.c
+++ b/dbutil.c
@@ -881,14 +881,17 @@ void disallow_core() {
/* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE, with the result in *val */
int m_str_to_uint(const char* str, unsigned int *val) {
+ unsigned long l;
errno = 0;
- *val = strtoul(str, NULL, 10);
+ l = strtoul(str, NULL, 10);
/* The c99 spec doesn't actually seem to define EINVAL, but most platforms
* I've looked at mention it in their manpage */
- if ((*val == 0 && errno == EINVAL)
- || (*val == ULONG_MAX && errno == ERANGE)) {
+ if ((l == 0 && errno == EINVAL)
+ || (l == ULONG_MAX && errno == ERANGE)
+ || (l > UINT_MAX)) {
return DROPBEAR_FAILURE;
} else {
+ *val = l;
return DROPBEAR_SUCCESS;
}
}