MINOR: net_helper: add functions to read from vectors
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Sep 2017 12:59:52 +0000 (14:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 20 Sep 2017 09:27:31 +0000 (11:27 +0200)
commitd5370e1d6c2007f07d1bf743aa6b8034a8196fda
tree79e33046768831d04181355e880e5210e6b487ec
parent26488ad358ab7c6d8cd801b3c63fa4cf87cedf8e
MINOR: net_helper: add functions to read from vectors

This patch adds the ability to read from a wrapping memory area (ie:
buffers). The new functions are called "readv_<type>". The original
ones were renamed to start with "read_" to make the difference more
obvious between the read method and the returned type.

It's worth noting that the memory barrier in readv_bytes() is critical,
as otherwise gcc decides that it doesn't need the resulting data, but
even worse, removes the length checks in readv_u64() and happily
performs an out-of-bounds unaligned read using read_u64()! Such
"optimizations" are a bit borderline, especially when they impact
security like this...
include/common/net_helper.h
src/dns.c