All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] huaweimodem: Fix DHCP parsing on 32-bit platforms
@ 2016-08-10 10:04 Santtu Lakkala
  2016-08-10 16:22 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Santtu Lakkala @ 2016-08-10 10:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

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.
---
 drivers/huaweimodem/gprs-context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/huaweimodem/gprs-context.c b/drivers/huaweimodem/gprs-context.c
index 3acd90c..dda5e32 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",
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] huaweimodem: Fix DHCP parsing on 32-bit platforms
  2016-08-10 10:04 [PATCH] huaweimodem: Fix DHCP parsing on 32-bit platforms Santtu Lakkala
@ 2016-08-10 16:22 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2016-08-10 16:22 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

Hi Santtu,

On 08/10/2016 05:04 AM, Santtu Lakkala wrote:
> 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.
> ---
>   drivers/huaweimodem/gprs-context.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>

Applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-10 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-10 10:04 [PATCH] huaweimodem: Fix DHCP parsing on 32-bit platforms Santtu Lakkala
2016-08-10 16:22 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.