From 051c2f8ea1f3fce3df7c8f46c571fbcca69dd495 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 4 Jul 2025 22:14:32 +0200 Subject: [PATCH] lldp: fix memchr() argument order The validation of embedded NUL character was skipped due to the wrong order of arguments to memchr(). Fix it. Fixes: 4043f8279003 ('lldp: cleanup converting binary LLDP fields to string') (cherry picked from commit ce17284c3f71322101f9dcc2272405c533dafc51) --- src/core/devices/nm-lldp-listener.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/devices/nm-lldp-listener.c b/src/core/devices/nm-lldp-listener.c index e08b379adf..5c90911fc3 100644 --- a/src/core/devices/nm-lldp-listener.c +++ b/src/core/devices/nm-lldp-listener.c @@ -310,7 +310,7 @@ format_string(const guint8 *data, gsize len, gboolean allow_trim, char **out_to_ if (len == 0) return NULL; - if (memchr(data, len, '\0')) + if (memchr(data, '\0', len)) return NULL; return nm_utils_buf_utf8safe_escape(data,