On Fri, 2019-06-21 at 14:23 -0500, Benjamin Marzinski wrote:
> On Fri, Jun 07, 2019 at 03:05:29PM +0200, Martin Wilck wrote:
> 
> Not a big deal since default socket is a defined string, but since we
> are writing to &addr.sun_path[1], if DEFAULT_SOCKET were of size >=
> "sizeof(addr.sun_path) - 1", the strncpy() would fill all of
> addr.sun_path, without leaving any space for the the null byte at the
> end. I assume you meant to change this to be strlcpy() instead of
> leaving it as strncpy().

I double-checked the man pages unix(7), and I found that abstract unix
socket names do not have to be zero-terminated ("null bytes in the name
have no special significance"). So strncpy() is actually correct in
this case. But the length argument to bind() should be checked.

Thanks,
Martin


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to