chiark / gitweb /
socket-util: explicitly ensure there's one trailing NUL byte on AF_UNIX socket addresses
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Dec 2017 16:18:02 +0000 (17:18 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:55 +0000 (07:49 +0200)
commit5295adaf6b864f44b0f6ad8ec5aeda540d9c236e
tree91e4c51804240f8e3e476c57c06de6f31b545fa0
parent40b65c54f284d54c057c25001d83bb3dbee9d7f4
socket-util: explicitly ensure there's one trailing NUL byte on AF_UNIX socket addresses

AF_UNIX socket addresses aren't necessarily NUL terminated, however
they are usually used as strings which are assumed to be NUL terminated.
Let's hence add an extra byte to the end of the sockaddr_un structure,
that contains this NUL byte, simply for safety reasons.

Note that actually this patch changes exactly nothing IRL, as the other
sockaddr structures already are large enough to accomodate for an extra
NUL byte. The size of the union hence doesn't change at all by doing
this. The entire value of this patch is hence in the philosophical
feeling of safety, and by making something explicit that before was
implicit.
src/basic/socket-util.h