module-avb: bound packet copy length in reply_status helper

This commit is contained in:
hackerman-kl 2026-04-24 07:02:54 +02:00
parent f091b85b03
commit 01dd7e607c

View file

@ -6,6 +6,7 @@
#ifndef __AVB_AECP_AEM_HELPERS_H__ #ifndef __AVB_AECP_AEM_HELPERS_H__
#define __AVB_AECP_AEM_HELPERS_H__ #define __AVB_AECP_AEM_HELPERS_H__
#include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@ -21,6 +22,11 @@ static inline int reply_status(struct aecp *aecp, int status, const void *m, int
struct avb_ethernet_header *h = (void*)buf; struct avb_ethernet_header *h = (void*)buf;
struct avb_packet_aecp_header *reply = SPA_PTROFF(h, sizeof(*h), void); struct avb_packet_aecp_header *reply = SPA_PTROFF(h, sizeof(*h), void);
if (len < 0 || (size_t)len > sizeof(buf)) {
pw_log_warn("reply_status: invalid len %d", len);
return -EINVAL;
}
memcpy(buf, m, len); memcpy(buf, m, len);
pw_log_debug("status 0x%x\n", status); pw_log_debug("status 0x%x\n", status);