Re: [PATCH net-next v2] tun: replace strcpy with strscpy for ifr_name
From: Willem de Bruijn
Date: Wed Aug 13 2025 - 09:08:41 EST
Miguel García wrote:
> Replace the strcpy() calls that copy the device name into ifr->ifr_name
> with strscpy() to avoid potential overflows and guarantee NULL termination.
>
> Destination is ifr->ifr_name (size IFNAMSIZ).
>
> Tested in QEMU (BusyBox rootfs):
> - Created TUN devices via TUNSETIFF helper
> - Set addresses and brought links up
> - Verified long interface names are safely truncated (IFNAMSIZ-1)
>
> Signed-off-by: Miguel García <miguelgarciaroman8@xxxxxxxxx>
Reviewed-by: Willem de Bruijn <willemb@xxxxxxxxxx>