aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ares/ares__get_hostent.c2
-rw-r--r--ares/ares_expand_name.c4
-rw-r--r--lib/dict.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/ares/ares__get_hostent.c b/ares/ares__get_hostent.c
index 8402714c4..d98af9283 100644
--- a/ares/ares__get_hostent.c
+++ b/ares/ares__get_hostent.c
@@ -194,7 +194,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
memcpy(hostent->h_addr_list[0], &addr6, addrlen);
/* Copy aliases. */
- hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
+ hostent->h_aliases = malloc((((size_t)naliases) + 1) * sizeof(char *));
if (!hostent->h_aliases)
break;
alias = hostent->h_aliases;
diff --git a/ares/ares_expand_name.c b/ares/ares_expand_name.c
index b0af474df..a1556e937 100644
--- a/ares/ares_expand_name.c
+++ b/ares/ares_expand_name.c
@@ -71,10 +71,10 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
const unsigned char *p;
len = name_length(encoded, abuf, alen);
- if (len == -1)
+ if (len < 0)
return ARES_EBADNAME;
- *s = malloc(len + 1);
+ *s = malloc(((size_t)len) + 1);
if (!*s)
return ARES_ENOMEM;
q = *s;
diff --git a/lib/dict.c b/lib/dict.c
index 223eddc0e..1c7d5c9f8 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -125,7 +125,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inputbuff)
if(!newp)
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) {
/* According to RFC2229 section 2.2, these letters need to be escaped with
\[letter] */