Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/ppp/usr.sbin/pppd use struct zero initialiser a...
details: https://anonhg.NetBSD.org/src/rev/034005811eef
branches: trunk
changeset: 943559:034005811eef
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Sep 06 08:15:04 2020 +0000
description:
use struct zero initialiser and avoid calling memset() on a pointer
of the wrong size.
diffstat:
external/bsd/ppp/usr.sbin/pppd/sys-bsd.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diffs (26 lines):
diff -r b2da7a905ce7 -r 034005811eef external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
--- a/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c Sun Sep 06 07:20:26 2020 +0000
+++ b/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c Sun Sep 06 08:15:04 2020 +0000
@@ -1879,10 +1879,10 @@
#define IFREQ_SAFE (sizeof(struct ifreq) + sizeof(struct sockaddr_dl))
/* XXX sockaddr_dl is larger than the sockaddr in struct ifreq! */
- union { /* XXX */
- struct ifreq _ifreq; /* XXX */
- char _X[IFREQ_SAFE]; /* XXX */
- } _ifreq_dontsmashstack; /* XXX */
+ union { /* XXX */
+ struct ifreq _ifreq; /* XXX */
+ char _X[IFREQ_SAFE]; /* XXX */
+ } _ifreq_dontsmashstack = {0}; /* XXX */
#define ifreq_xxx _ifreq_dontsmashstack._ifreq /* XXX */
struct sockaddr_dl *sdl = (struct sockaddr_dl *) &ifreq_xxx.ifr_addr;
@@ -1890,7 +1890,6 @@
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
return 0;
- (void)memset(sdl, 0, sizeof(*sdl));
sdl->sdl_family = AF_LINK;
(void)strlcpy(ifreq_xxx.ifr_name, name, sizeof(ifreq_xxx.ifr_name));
if (ioctl(fd, SIOCGIFADDR, &ifreq_xxx) == -1) {
Home |
Main Index |
Thread Index |
Old Index