pgsql: Fix unportable disregard of alignment requirements in RADIUS cod

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix unportable disregard of alignment requirements in RADIUS cod
Date: 2017-03-26 21:35:58
Message-ID: E1csFpO-0003r2-DY@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/c804c00d38f6a848f0d7e57a05ea5468fc5762b2

Modified Files
--------------
src/backend/libpq/auth.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-03-26 21:44:41 pgsql: Fix typos in logical replication support for initial data copy.
Previous Message Tom Lane 2017-03-26 19:57:07 pgsql: Improve implementation of EEOP_BOOLTEST_* opcodes.