From: Sean Bright Date: Wed, 19 Jan 2011 17:56:32 +0000 (+0000) Subject: Make sure that h_length is set when we short-circuit out of ast_gethostbyname. X-Git-Tag: 1.6.2.18-rc1~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24fbdc445b3b7b13ff797ed8c0cf252708213f86;p=thirdparty%2Fasterisk.git Make sure that h_length is set when we short-circuit out of ast_gethostbyname. (closes issue #16135) Reported by: thedavidfactor Patches: utils.patch uploaded by thedavidfactor (license 903) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@302504 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/utils.c b/main/utils.c index 871784563a..51f1283b53 100644 --- a/main/utils.c +++ b/main/utils.c @@ -208,6 +208,8 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp) hp->hp.h_addrtype = AF_INET; hp->hp.h_addr_list = (void *) hp->buf; hp->hp.h_addr = hp->buf + sizeof(void *); + /* For AF_INET, this will always be 4 */ + hp->hp.h_length = 4; if (inet_pton(AF_INET, host, hp->hp.h_addr) > 0) return &hp->hp; return NULL;