On Mon, May 02, 2022 at 11:06:04AM +0200, Arkadiusz Kubalewski wrote:
> Interface is used to create and store an opened socket for sending and
> receiving SyncE PDU's on a given NIC interface.

> +++ b/synce_transport.c

> +struct synce_transport *synce_transport_create(const char *iface)
> +{
...
> +     if (strnlen(iface, IFNAMSIZ) == IFNAMSIZ) {
> +             pr_err("interface name too long");
> +             goto err;
> +     }
> +     strncpy(transport->iface, iface,
> +             (sizeof(transport->iface)/sizeof(*transport->iface)));

That division looks odd here as strncpy works with chars.

Anyway, this code seems to be confusing the compiler, assuming it can
produce an unterminated string, so maybe just use
"if (snprintf(...) >= IFNAMSIZ)" instead of strnlen() + strncpy()?

-- 
Miroslav Lichvar



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to