]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: dns: fix alignment issue when building DNS queries
authorVincent Bernat <vincent@bernat.im>
Fri, 8 Apr 2016 20:17:45 +0000 (22:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 May 2016 09:01:08 +0000 (11:01 +0200)
commit9b7125cde9de3d69e6c8c75e1740bc2ef7d4a668
tree39277327c63159778b017945f571c32b5e00c47e
parente2f84977165a6d0f4674d4aaa3d1a4993b964f6a
BUG/MEDIUM: dns: fix alignment issue when building DNS queries

On some architectures, unaligned access is not authorized. On most
architectures, it is just slower. Therefore, we have to use memcpy()
when an unaligned access is needed, specifically when writing the qinfo.

Also remove the unaligned access when reading answer count when reading
the answer. It's likely that this instruction was optimized away by the
compiler since it is unneeded. Add a comment to explain why we use 7 as
an offset instead of 6. Not an unaligned offset since "resp" is
"unsigned char", then promoted to int.
src/dns.c