[ic] vlink MINIVEND_SOCKET patch

David Christensen david at endpoint.com
Tue May 5 15:43:50 UTC 2020


Hi Peter,

Thanks for the patch.

>   sa.sun_family = AF_UNIX;
> -  strcpy(sa.sun_path, LINK_FILE);
> +  strncpy(sa.sun_path, lsocket, sizeof(sa.sun_path) - 1);

A couple of questions: is the sa struct guaranteed to be zero’d, so we don’t need to worry about a NULL terminator (i.e., why there’s a -1 in sizeof call)?  Also, if strlen(lsocket) > sizeof(sa.sun_path), a truncated copy would end up being bunko, since it won’t refer to an actual valid path; would it be better to just check if strlen(lsocket) > sizeof(sa.sun_path) -1 and error out if so?

Best,

David
--
David Christensen
Senior Software and Database Engineer
End Point Corporation
david at endpoint.com
785-727-1171


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://www.interchangecommerce.org/pipermail/interchange-users/attachments/20200505/fa897b36/attachment.sig>


More information about the interchange-users mailing list