PATCH: trailing nul bytes in abstract socket names
John (J5) Palmieri
johnp at redhat.com
Thu Sep 29 14:17:12 PDT 2005
Here is the patch with your suggestions. I now check the length and
return -1 with the error set if it is greater than
_DBUS_MAX_SUN_PATH_LENGTH. We assume no terminating nul byte. I still
have to write up the blurb in the spec.
On Wed, 2005-09-28 at 22:06 -0400, Havoc Pennington wrote:
> On Wed, 2005-09-28 at 20:50 -0400, John (J5) Palmieri wrote:
> > */
> > addr.sun_path = '\0'; /* this is what says "use abstract" */
> > strncpy (&addr.sun_path, path, _DBUS_MAX_SUN_PATH_LENGTH -
> > 2);
> This part should use path_len also since we are no longer using the full
> length of sun_path, right?
> > + path_len++; /* add the extra NULL byte */
> I think you're adding the nul byte at the front but not the nul
> termination here... which may be right I guess.
> > - if (connect (fd, (struct sockaddr*) &addr, sizeof (addr)) < 0)
> > + if (connect (fd, (struct sockaddr*) &addr, _DBUS_STRUCT_OFFSET
> > (struct sockaddr_un, sun_path) + path_len) < 0)
> I'd say we also need a spec patch that discusses exactly which bytes are
> included (e.g. whether or not nul termination is)
John (J5) Palmieri <johnp at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4440 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050929/5bfc9908/dbus-abstract-socket-2-0001.bin
More information about the dbus