Re: [PATCH v12 05/17] telemetry: check for path overflow

Bruce Richardson
2026-01-27T08:51:55Z

On Mon, Jan 26, 2026 at 03:22:13PM -0800, Stephen Hemminger wrote:
> The unix domain socket path is limited, check for overflow.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> lib/telemetry/telemetry_legacy.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/telemetry/telemetry_legacy.c b/lib/telemetry/telemetry_legacy.c
> index 89ec750c09..1d73282ba8 100644
> --- a/lib/telemetry/telemetry_legacy.c
> +++ b/lib/telemetry/telemetry_legacy.c
> @@ -102,14 +102,17 @@ register_client(const char *cmd __rte_unused, const char *params,
> return -1;
> }
> *strchr(data, '\"') = 0;
> + addrs.sun_family = AF_UNIX;
> + if (strlcpy(addrs.sun_path, data, sizeof(addrs.sun_path)) >= sizeof(addrs.sun_path)) {
> + fprintf(stderr, "Client path too long\n");
> + return -1;
> + }
>
> fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
> if (fd < 0) {
> perror("Failed to open socket");
> return -1;
> }
> - addrs.sun_family = AF_UNIX;
> - strlcpy(addrs.sun_path, data, sizeof(addrs.sun_path));
>
> if (connect(fd, (struct sockaddr *)&addrs, sizeof(addrs)) == -1) {
> perror("\nClient connection error\n");
> --
> 2.51.0
>