Fix ff tools build error with gcc-13.2.0.

This commit is contained in:
fengbojiang 2024-10-12 21:09:39 +08:00
parent 38d9fdee68
commit 473c99d77e
4 changed files with 17 additions and 11 deletions

View File

@ -5,7 +5,7 @@
/*- /*-
* Copyright (c) 1996-1999 Whistle Communications, Inc. * Copyright (c) 1996-1999 Whistle Communications, Inc.
* All rights reserved. * All rights reserved.
* *
* Subject to the following obligations and disclaimer of warranty, use and * Subject to the following obligations and disclaimer of warranty, use and
* redistribution of this software, in source or object code forms, with or * redistribution of this software, in source or object code forms, with or
* without modifications are expressly permitted by Whistle Communications; * without modifications are expressly permitted by Whistle Communications;
@ -16,7 +16,7 @@
* Communications, Inc. trademarks, including the mark "WHISTLE * Communications, Inc. trademarks, including the mark "WHISTLE
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as * COMMUNICATIONS" on advertising, endorsements, or otherwise except as
* such appears in the above copyright notice or in the software. * such appears in the above copyright notice or in the software.
* *
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
@ -62,7 +62,7 @@ enum {
struct sockaddr_ng { struct sockaddr_ng {
unsigned char sg_len; /* total length */ unsigned char sg_len; /* total length */
sa_family_t sg_family; /* address family */ 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_ */ #endif /* _NETGRAPH_NG_SOCKET_H_ */

View File

@ -5,7 +5,7 @@
/*- /*-
* Copyright (c) 1996-1999 Whistle Communications, Inc. * Copyright (c) 1996-1999 Whistle Communications, Inc.
* All rights reserved. * All rights reserved.
* *
* Subject to the following obligations and disclaimer of warranty, use and * Subject to the following obligations and disclaimer of warranty, use and
* redistribution of this software, in source or object code forms, with or * redistribution of this software, in source or object code forms, with or
* without modifications are expressly permitted by Whistle Communications; * without modifications are expressly permitted by Whistle Communications;
@ -16,7 +16,7 @@
* Communications, Inc. trademarks, including the mark "WHISTLE * Communications, Inc. trademarks, including the mark "WHISTLE
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as * COMMUNICATIONS" on advertising, endorsements, or otherwise except as
* such appears in the above copyright notice or in the software. * such appears in the above copyright notice or in the software.
* *
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
@ -62,7 +62,7 @@ enum {
struct sockaddr_ng { struct sockaddr_ng {
unsigned char sg_len; /* total length */ unsigned char sg_len; /* total length */
sa_family_t sg_family; /* address family */ 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_ */ #endif /* _NETGRAPH_NG_SOCKET_H_ */

View File

@ -3,7 +3,7 @@
* *
* Copyright (c) 1996-1999 Whistle Communications, Inc. * Copyright (c) 1996-1999 Whistle Communications, Inc.
* All rights reserved. * All rights reserved.
* *
* Subject to the following obligations and disclaimer of warranty, use and * Subject to the following obligations and disclaimer of warranty, use and
* redistribution of this software, in source or object code forms, with or * redistribution of this software, in source or object code forms, with or
* without modifications are expressly permitted by Whistle Communications; * without modifications are expressly permitted by Whistle Communications;
@ -14,7 +14,7 @@
* Communications, Inc. trademarks, including the mark "WHISTLE * Communications, Inc. trademarks, including the mark "WHISTLE
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as * COMMUNICATIONS" on advertising, endorsements, or otherwise except as
* such appears in the above copyright notice or in the software. * such appears in the above copyright notice or in the software.
* *
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
@ -233,7 +233,10 @@ NgDeliverMsg(int cs, const char *path,
/* Prepare socket address */ /* Prepare socket address */
sg->sg_family = AF_NETGRAPH; sg->sg_family = AF_NETGRAPH;
/* XXX handle overflow */ /* 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; sg->sg_len = strlen(sg->sg_data) + 1 + NGSA_OVERHEAD;
/* Debugging */ /* Debugging */

View File

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