This is an automated email from the ASF dual-hosted git repository.
ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 54bef649e net/ptpd: fix compile warning issue
54bef649e is described below
commit 54bef649ea14d293128545f24c9db2594197a327
Author: gaohedong <[email protected]>
AuthorDate: Mon Jul 7 22:41:19 2025 +0800
net/ptpd: fix compile warning issue
In some scenarios, dynamic memory allocation is not allowed, so it is
modified to a static allocation method.
Signed-off-by: gaohedong <[email protected]>
---
netutils/ptpd/ptpd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/netutils/ptpd/ptpd.c b/netutils/ptpd/ptpd.c
index 3193ee33e..f85619093 100644
--- a/netutils/ptpd/ptpd.c
+++ b/netutils/ptpd/ptpd.c
@@ -758,11 +758,13 @@ static int ptp_sendmsg(FAR struct ptp_state_s *state, FAR
const void *buf,
0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e
};
- char raw[sizeof(struct ether_header) + buflen];
+ char raw[sizeof(struct ether_header) + sizeof(struct ptp_announce_s)];
FAR struct ether_header *header;
struct msghdr msg;
struct iovec iov;
+ DEBUGASSERT(sizeof(struct ptp_announce_s) >= buflen);
+
header = (FAR struct ether_header *)&raw;
memcpy(header->ether_dhost, ptp_multicast_mac, ETHER_ADDR_LEN);
netlib_getmacaddr(state->config->interface, header->ether_shost);