Fix compiler warning: addition result could be truncated before cast to bigger sized type
This commit is contained in:
parent
b38e28b6bc
commit
4798f4e652
@ -194,7 +194,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
|
|||||||
memcpy(hostent->h_addr_list[0], &addr6, addrlen);
|
memcpy(hostent->h_addr_list[0], &addr6, addrlen);
|
||||||
|
|
||||||
/* Copy aliases. */
|
/* Copy aliases. */
|
||||||
hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
|
hostent->h_aliases = malloc((((size_t)naliases) + 1) * sizeof(char *));
|
||||||
if (!hostent->h_aliases)
|
if (!hostent->h_aliases)
|
||||||
break;
|
break;
|
||||||
alias = hostent->h_aliases;
|
alias = hostent->h_aliases;
|
||||||
|
@ -71,10 +71,10 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
|
|||||||
const unsigned char *p;
|
const unsigned char *p;
|
||||||
|
|
||||||
len = name_length(encoded, abuf, alen);
|
len = name_length(encoded, abuf, alen);
|
||||||
if (len == -1)
|
if (len < 0)
|
||||||
return ARES_EBADNAME;
|
return ARES_EBADNAME;
|
||||||
|
|
||||||
*s = malloc(len + 1);
|
*s = malloc(((size_t)len) + 1);
|
||||||
if (!*s)
|
if (!*s)
|
||||||
return ARES_ENOMEM;
|
return ARES_ENOMEM;
|
||||||
q = *s;
|
q = *s;
|
||||||
|
@ -125,7 +125,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inputbuff)
|
|||||||
if(!newp)
|
if(!newp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dictp = malloc(len*2 + 1); /* add one for terminating zero */
|
dictp = malloc(((size_t)len)*2 + 1); /* add one for terminating zero */
|
||||||
if(dictp) {
|
if(dictp) {
|
||||||
/* According to RFC2229 section 2.2, these letters need to be escaped with
|
/* According to RFC2229 section 2.2, these letters need to be escaped with
|
||||||
\[letter] */
|
\[letter] */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user