Skip to content

Commit fc0f76b

Browse files
committed
Fix ff tools build error with gcc-13.2.0.
1 parent 3fbb555 commit fc0f76b

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

freebsd/netgraph/ng_socket.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/*-
66
* Copyright (c) 1996-1999 Whistle Communications, Inc.
77
* All rights reserved.
8-
*
8+
*
99
* Subject to the following obligations and disclaimer of warranty, use and
1010
* redistribution of this software, in source or object code forms, with or
1111
* without modifications are expressly permitted by Whistle Communications;
@@ -16,7 +16,7 @@
1616
* Communications, Inc. trademarks, including the mark "WHISTLE
1717
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as
1818
* such appears in the above copyright notice or in the software.
19-
*
19+
*
2020
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
2121
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
2222
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
@@ -62,7 +62,7 @@ enum {
6262
struct sockaddr_ng {
6363
unsigned char sg_len; /* total length */
6464
sa_family_t sg_family; /* address family */
65-
char sg_data[14]; /* actually longer; address value */
65+
char sg_data[32]; /* see NG_NODESIZ in ng_message.h */
6666
};
6767

6868
#endif /* _NETGRAPH_NG_SOCKET_H_ */

tools/compat/include/netgraph/ng_socket.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/*-
66
* Copyright (c) 1996-1999 Whistle Communications, Inc.
77
* All rights reserved.
8-
*
8+
*
99
* Subject to the following obligations and disclaimer of warranty, use and
1010
* redistribution of this software, in source or object code forms, with or
1111
* without modifications are expressly permitted by Whistle Communications;
@@ -16,7 +16,7 @@
1616
* Communications, Inc. trademarks, including the mark "WHISTLE
1717
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as
1818
* such appears in the above copyright notice or in the software.
19-
*
19+
*
2020
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
2121
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
2222
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
@@ -62,7 +62,7 @@ enum {
6262
struct sockaddr_ng {
6363
unsigned char sg_len; /* total length */
6464
sa_family_t sg_family; /* address family */
65-
char sg_data[14]; /* actually longer; address value */
65+
char sg_data[32]; /* see NG_NODESIZ in ng_message.h */
6666
};
6767

6868
#endif /* _NETGRAPH_NG_SOCKET_H_ */

tools/libnetgraph/msg.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 1996-1999 Whistle Communications, Inc.
55
* All rights reserved.
6-
*
6+
*
77
* Subject to the following obligations and disclaimer of warranty, use and
88
* redistribution of this software, in source or object code forms, with or
99
* without modifications are expressly permitted by Whistle Communications;
@@ -14,7 +14,7 @@
1414
* Communications, Inc. trademarks, including the mark "WHISTLE
1515
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as
1616
* such appears in the above copyright notice or in the software.
17-
*
17+
*
1818
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
1919
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
2020
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
@@ -217,7 +217,10 @@ NgDeliverMsg(int cs, const char *path,
217217
/* Prepare socket address */
218218
sg->sg_family = AF_NETGRAPH;
219219
/* XXX handle overflow */
220-
strlcpy(sg->sg_data, path, NG_PATHSIZ);
220+
#pragma GCC diagnostic push
221+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
222+
strncpy(sg->sg_data, path, NG_PATHSIZ);
223+
#pragma GCC diagnostic pop
221224
sg->sg_len = strlen(sg->sg_data) + 1 + NGSA_OVERHEAD;
222225

223226
/* Debugging */

tools/ngctl/write.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
*
55
* Copyright (c) 2002 Archie L. Cobbs
66
* All rights reserved.
7-
*
7+
*
88
* Subject to the following obligations and disclaimer of warranty, use and
99
* redistribution of this software, in source or object code forms, with or
1010
* without modifications are expressly permitted by Archie L. Cobbs;
1111
* provided, however, that:
1212
* 1. Any and all reproductions of the source or object code must include the
1313
* copyright notice above and the following disclaimer of warranties
14-
*
14+
*
1515
* THIS SOFTWARE IS BEING PROVIDED BY ARCHIE L. COBBS AS IS", AND TO
1616
* THE MAXIMUM EXTENT PERMITTED BY LAW, ARCHIE L. COBBS MAKES NO
1717
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
@@ -108,7 +108,10 @@ WriteCmd(int ac, char **av)
108108
/* Send data */
109109
sag->sg_len = 3 + strlen(hook);
110110
sag->sg_family = AF_NETGRAPH;
111+
#pragma GCC diagnostic push
112+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
111113
strlcpy(sag->sg_data, hook, sizeof(sagbuf) - 2);
114+
#pragma GCC diagnostic pop
112115
if (sendto(dsock, buf, len,
113116
0, (struct sockaddr *)sag, sag->sg_len) == -1) {
114117
warn("writing to hook \"%s\"", hook);

0 commit comments

Comments
 (0)