diff --git a/freebsd/netgraph/ng_socket.h b/freebsd/netgraph/ng_socket.h index 52886664a..9f164a51c 100644 --- a/freebsd/netgraph/ng_socket.h +++ b/freebsd/netgraph/ng_socket.h @@ -5,7 +5,7 @@ /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. - * + * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Whistle Communications; @@ -16,7 +16,7 @@ * Communications, Inc. trademarks, including the mark "WHISTLE * COMMUNICATIONS" on advertising, endorsements, or otherwise except as * such appears in the above copyright notice or in the software. - * + * * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, @@ -62,7 +62,7 @@ enum { struct sockaddr_ng { unsigned char sg_len; /* total length */ sa_family_t sg_family; /* address family */ - char sg_data[14]; /* actually longer; address value */ + char sg_data[32]; /* see NG_NODESIZ in ng_message.h */ }; #endif /* _NETGRAPH_NG_SOCKET_H_ */ diff --git a/tools/compat/include/netgraph/ng_socket.h b/tools/compat/include/netgraph/ng_socket.h index b7e831018..a467fabd9 100644 --- a/tools/compat/include/netgraph/ng_socket.h +++ b/tools/compat/include/netgraph/ng_socket.h @@ -5,7 +5,7 @@ /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. - * + * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Whistle Communications; @@ -16,7 +16,7 @@ * Communications, Inc. trademarks, including the mark "WHISTLE * COMMUNICATIONS" on advertising, endorsements, or otherwise except as * such appears in the above copyright notice or in the software. - * + * * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, @@ -62,7 +62,7 @@ enum { struct sockaddr_ng { unsigned char sg_len; /* total length */ sa_family_t sg_family; /* address family */ - char sg_data[14]; /* actually longer; address value */ + char sg_data[32]; /* see NG_NODESIZ in ng_message.h */ }; #endif /* _NETGRAPH_NG_SOCKET_H_ */ diff --git a/tools/libnetgraph/msg.c b/tools/libnetgraph/msg.c index 12917e571..62d14c8f2 100644 --- a/tools/libnetgraph/msg.c +++ b/tools/libnetgraph/msg.c @@ -3,7 +3,7 @@ * * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. - * + * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Whistle Communications; @@ -14,7 +14,7 @@ * Communications, Inc. trademarks, including the mark "WHISTLE * COMMUNICATIONS" on advertising, endorsements, or otherwise except as * such appears in the above copyright notice or in the software. - * + * * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, @@ -233,7 +233,10 @@ NgDeliverMsg(int cs, const char *path, /* Prepare socket address */ sg->sg_family = AF_NETGRAPH; /* XXX handle overflow */ - strlcpy(sg->sg_data, path, NG_PATHSIZ); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" + strncpy(sg->sg_data, path, NG_PATHSIZ); +#pragma GCC diagnostic pop sg->sg_len = strlen(sg->sg_data) + 1 + NGSA_OVERHEAD; /* Debugging */ diff --git a/tools/ngctl/write.c b/tools/ngctl/write.c index 411421170..9c6b3fa5a 100644 --- a/tools/ngctl/write.c +++ b/tools/ngctl/write.c @@ -4,14 +4,14 @@ * * Copyright (c) 2002 Archie L. Cobbs * All rights reserved. - * + * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Archie L. Cobbs; * provided, however, that: * 1. Any and all reproductions of the source or object code must include the * copyright notice above and the following disclaimer of warranties - * + * * THIS SOFTWARE IS BEING PROVIDED BY ARCHIE L. COBBS AS IS", AND TO * THE MAXIMUM EXTENT PERMITTED BY LAW, ARCHIE L. COBBS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, @@ -108,7 +108,10 @@ WriteCmd(int ac, char **av) /* Send data */ sag->sg_len = 3 + strlen(hook); sag->sg_family = AF_NETGRAPH; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" strlcpy(sag->sg_data, hook, sizeof(sagbuf) - 2); +#pragma GCC diagnostic pop if (sendto(dsock, buf, len, 0, (struct sockaddr *)sag, sag->sg_len) == -1) { warn("writing to hook \"%s\"", hook);