aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-11-15 23:07:35 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-11-15 23:07:35 +0000
commit9818bf7026068c0715700eacd3a81b72082f0b71 (patch)
tree978ba9e4d608a0e601e6fd0dd93742f92a49c4a1
parent73c7acb159bfc136f8814ec03a1eb84d58fc0475 (diff)
Fixed an OOM condition reported by Jim Meyering
-rw-r--r--ares/ares_parse_ptr_reply.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ares/ares_parse_ptr_reply.c b/ares/ares_parse_ptr_reply.c
index 13ff6521e..c5d8e14c8 100644
--- a/ares/ares_parse_ptr_reply.c
+++ b/ares/ares_parse_ptr_reply.c
@@ -125,8 +125,15 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
}
strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1);
aliascnt++;
- if ((aliascnt%8)==0)
- aliases = realloc(aliases, (aliascnt/16+1) * sizeof(char *));
+ if ((aliascnt%8)==0) {
+ char **ptr;
+ ptr = realloc(aliases, (aliascnt/16+1) * sizeof(char *));
+ if(!ptr) {
+ status = ARES_ENOMEM;
+ break;
+ }
+ aliases = ptr;
+ }
}
if (rr_class == C_IN && rr_type == T_CNAME)