0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-19 19:52:15 +02:00

lzo_asym_impl: fix unaligned access

Helpfully the comment above the code actually provided
a solution...

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit db7ea3d96a)
This commit is contained in:
Frank Lichtenheld 2023-02-24 21:39:54 +01:00 committed by Yuriy Darnobyt
parent 37fb7c2efc
commit a830d1e09c

View File

@ -107,9 +107,7 @@ inline size_t ptr_diff(const T *a, const T *b)
// read uint16_t from memory
inline size_t get_u16(const unsigned char *p)
{
// NOTE: assumes little-endian and unaligned 16-bit access is okay.
// For a slower alternative without these assumptions, try: p[0] | (p[1] << 8)
return get_mem<std::uint16_t>(p);
return p[0] | (p[1] << 8);
}
/**