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)
committerLennart Poettering <lennart@poettering.net>
Fri, 5 Jan 2018 12:55:08 +0000 (13:55 +0100)
commit8b7f989a5824869a5ca9983b225758a8c2fd8f4a
treeb4a12e42eeb1ce150c3e72537f6c7833ba5011ba
parent89220e2fb6d49df31bed4205c9c84883749483bc
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