summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanttu Lakkala <santtu.lakkala@link-motion.com>2016-08-10 13:04:07 +0300
committerDenis Kenzior <denkenz@gmail.com>2016-08-10 11:21:56 -0500
commit54c9068ff2f9e3469e67a8cb862c247cb5d70221 (patch)
treeb88067111b1651363a965fcead73bf5dcc25ce38
parent27f9da901f3ffe382867db92d009b2e65ca691fc (diff)
downloadofono-54c9068ff2f9e3469e67a8cb862c247cb5d70221.tar.gz
huaweimodem: Fix DHCP parsing on 32-bit platforms
strtol clamps returned value between INT_MIN and INT_MAX, causing invalid value (255.255.255.127) being reported for any address if last octet > 127 when sizeof(long) == 4.
-rw-r--r--drivers/huaweimodem/gprs-context.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/huaweimodem/gprs-context.c b/drivers/huaweimodem/gprs-context.c
index 3acd90c2..dda5e32d 100644
--- a/drivers/huaweimodem/gprs-context.c
+++ b/drivers/huaweimodem/gprs-context.c
@@ -80,7 +80,7 @@ static gboolean get_next_addr(GAtResultIter *iter, char **addr)
if (g_at_result_iter_next_unquoted_string(iter, &str) == FALSE)
return FALSE;
- val = strtol(str, NULL, 16);
+ val = strtoul(str, NULL, 16);
if (addr)
*addr = g_strdup_printf("%u.%u.%u.%u",