]> granicus.if.org Git - postgresql/commit
Fix unportable disregard of alignment requirements in RADIUS code.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 26 Mar 2017 21:35:35 +0000 (17:35 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 26 Mar 2017 21:35:35 +0000 (17:35 -0400)
commit3455ddbfa6b7c38d55d2638d062f311343b8f053
tree8f389d164f89c0fb6dd2ae19bcfaec4cef2e6dc6
parente0e1ef46d8c98dc71f23572851b5467185fae8e0
Fix unportable disregard of alignment requirements in RADIUS code.

The compiler is entitled to store a char[] local variable with no
particular alignment requirement.  Our RADIUS code cavalierly took such
a local variable and cast its address to a struct type that does have
alignment requirements.  On an alignment-picky machine this would lead
to bus errors.  To fix, declare the local variable honestly, and then
cast its address to char * for use in the I/O calls.

Given the lack of field complaints, there must be very few if any
people affected; but nonetheless this is a clear portability issue,
so back-patch to all supported branches.

Noted while looking at a Coverity complaint in the same code.
src/backend/libpq/auth.c