[SSSD] [PATCH] netlink integration: ensure that interface name is NULL-terminated

Stephen Gallagher sgallagh at redhat.com
Thu Apr 5 18:15:18 UTC 2012


On Thu, 2012-04-05 at 14:07 -0400, Jakub Hrozek wrote:
> Reported in https://bugzilla.redhat.com/show_bug.cgi?id=808107
> 
> In the unlikely case that the interface name was IFNAMSIZ bytes long or
> longer, strncpy wouldn't NULL-terminate the buffer. Copy one byte less
> to ensure the buffer is NULL-terminated.

Nack, this is incomplete. You need to do:

strncpy(iwr.ifr_ifrn.ifrn_name, ifname, IFNAMSIZ-1);
iwr.ifr_ifrn.ifrn_name[IFNAMSIZ-1] = '\0';
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20120405/34af4886/attachment.sig>


More information about the sssd-devel mailing list