[patch] check and fix buffer alignment in _nss_dns_gethostbyaddr2_r

Rafael Espindola espindola@google.com
Thu Jan 1 16:01:00 GMT 2009


The buffer argument to _nss_dns_gethostbyaddr2_r is a char* and need
not be 8 bytes aligned. On amd64, the host_data structure has to be 8
bytes aligned and the cast

host_data = (struct host_data *) buffer;

will cause problems if buffer is not 8 bytes aligned.

Other functions in dns-host.c (like getanswer_r) and
_nss_nis_gethostbyaddr_r in nis-hosts.c already check and fix the
buffer alignment. This patch is mostly a copy and paste of that
adjustment.

I did a "make check" on linux x86-64. Is that the normal patch test
procedure for glibc? How do I check the results? :-)

2008-12-31  Rafael Avila de Espindola  <espindola@google.com>

	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr2_r): Check and
	adjust the buffer alignment.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
-------------- next part --------------
A non-text attachment was scrubbed...
Name: align.patch
Type: text/x-patch
Size: 1074 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20090101/d0db788a/attachment.bin>


More information about the Libc-alpha mailing list