summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-08-04 17:38:10 +0300
committerDenys Fedoryshchenko <denys.f@collabora.com>2026-08-12 10:42:12 +0300
commit36c440758fc9fd606fbdfe342a4b3fd842d05c4e (patch)
tree7870e856d2cb4d1ecd4db9ae73d0014ef26b5db4 /.github
parentead8a7839bf2a8dbb4358fb115ed98d688bf2c28 (diff)
downloadaccel-ppp-36c440758fc9fd606fbdfe342a4b3fd842d05c4e.tar.gz
accel-ppp-36c440758fc9fd606fbdfe342a4b3fd842d05c4e.zip
l2tp: read and write AVP values through unaligned-safe accessors
AVPs are packed back to back in the receive buffer, so the offset of any given AVP is the sum of the lengths of all the AVPs before it, i.e. a value the peer picks. Casting avp->val to uint16_t/uint32_t/uint64_t therefore dereferences a pointer with an arbitrary alignment, which is undefined behaviour, is caught by -fsanitize=alignment, and is only harmless on x86 by accident. The same applies to the send path, where the AVPs being built are laid out the same way. Introduce unaligned_{ntohs,ntohl,be64toh}() and their store counterparts, all memcpy() based, and use them for every multi-byte field read out of or written into an AVP body. Accesses to the members of struct l2tp_avp_t itself are fine as it is declared packed. memxor() had the same problem, in a worse form: it cast both of its uint8_t pointers to uintmax_t and walked them word by word. Since it is only ever called on MD5 sized chunks, replace it with a plain byte loop which compilers vectorize just as well, and which no longer breaks strict aliasing either. No functional change intended, this is a portability and UB fix; it also removes a source of noise for the s390x (big endian) CI job.
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions