diff --git a/tools/libnetgraph/msg.c b/tools/libnetgraph/msg.c index 92e186dbf..1d86ba2d8 100644 --- a/tools/libnetgraph/msg.c +++ b/tools/libnetgraph/msg.c @@ -217,10 +217,14 @@ NgDeliverMsg(int cs, const char *path, /* Prepare socket address */ sg->sg_family = AF_NETGRAPH; /* XXX handle overflow */ +#if __GNUC__ >= 13 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif strncpy(sg->sg_data, path, NG_PATHSIZ); +#if __GNUC__ >= 13 #pragma GCC diagnostic pop +#endif sg->sg_len = strlen(sg->sg_data) + 1 + NGSA_OVERHEAD; /* Debugging */ diff --git a/tools/ngctl/write.c b/tools/ngctl/write.c index 9c6b3fa5a..25cc99a2e 100644 --- a/tools/ngctl/write.c +++ b/tools/ngctl/write.c @@ -108,10 +108,14 @@ WriteCmd(int ac, char **av) /* Send data */ sag->sg_len = 3 + strlen(hook); sag->sg_family = AF_NETGRAPH; +#if __GNUC__ >= 13 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif strlcpy(sag->sg_data, hook, sizeof(sagbuf) - 2); +#if __GNUC__ >= 13 #pragma GCC diagnostic pop +#endif if (sendto(dsock, buf, len, 0, (struct sockaddr *)sag, sag->sg_len) == -1) { warn("writing to hook \"%s\"", hook);