Fix invalid reads/writes due to incorrect sizeof().

These few places in the code used sizeof() on h_addr in struct hostent.
This is sizeof(char *).  The correct way to get the size of this address is to
use h_length.  This error would result in reads/writes of 8 bytes instead of 4
on 64-bit machines.
........

Merged revisions 359211 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 359212 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2012-03-14 10:05:07 +00:00
parent 6ac425df31
commit 6c9f009b6d
2 changed files with 3 additions and 3 deletions

View File

@@ -515,7 +515,7 @@ static int app_exec(struct ast_channel *chan, const char *data)
ast_gethostbyname(hostname, &hp);
remote_address_tmp.sin_family = AF_INET;
remote_address_tmp.sin_port = htons(port);
memcpy(&remote_address_tmp.sin_addr.s_addr, hp.hp.h_addr, sizeof(hp.hp.h_addr));
memcpy(&remote_address_tmp.sin_addr.s_addr, hp.hp.h_addr, hp.hp.h_length);
ast_sockaddr_from_sin(&ivr_desc.remote_address, &remote_address_tmp);
if (!(ser = ast_tcptls_client_create(&ivr_desc)) || !(ser = ast_tcptls_client_start(ser))) {
goto exit;