diff options
Diffstat (limited to 'src/sm_genid.c')
-rw-r--r-- | src/sm_genid.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sm_genid.c b/src/sm_genid.c index ef7acae..bcd10a6 100644 --- a/src/sm_genid.c +++ b/src/sm_genid.c @@ -149,7 +149,7 @@ SmsGenerateClientID(SmsConn smsConn) char* inet_addr; char *ptr1; unsigned char decimal[4]; - int i, len; + int i; struct in_addr *haddr = NULL; # if defined(IPv6) && defined(AF_INET6) struct addrinfo *ai, *first_ai; @@ -202,8 +202,8 @@ SmsGenerateClientID(SmsConn smsConn) { char temp4[4]; char *ptr2 = strchr (ptr1, '.'); + size_t len = (size_t) (ptr2 - ptr1); - len = ptr2 - ptr1; if (!ptr2 || len > 3) { # if defined(IPv6) && defined(AF_INET6) freeaddrinfo(first_ai); @@ -212,11 +212,11 @@ SmsGenerateClientID(SmsConn smsConn) } strncpy (temp4, ptr1, len); temp4[len] = '\0'; - decimal[i] = atoi (temp4); + decimal[i] = (unsigned char) atoi (temp4); ptr1 = ptr2 + 1; } - decimal[3] = atoi (ptr1); + decimal[3] = (unsigned char) atoi (ptr1); *addr_ptr++ = '1'; |