diff options
author | 2003-09-19 00:27:02 +0000 | |
---|---|---|
committer | 2003-09-19 00:27:02 +0000 | |
commit | cb61fcb665d676c60b650cc4517049c4b1afc5b2 (patch) | |
tree | c0b5e1927772092fa5566602f59a584c486cc848 | |
parent | realloc spring cleaning, simplifies the code some (diff) | |
download | wireguard-openbsd-cb61fcb665d676c60b650cc4517049c4b1afc5b2.tar.xz wireguard-openbsd-cb61fcb665d676c60b650cc4517049c4b1afc5b2.zip |
Put in a couple of sanity checks to ensure that the AN_DEFAULT_*
variables arent defined too large.
itojun@ ok
-rw-r--r-- | sys/dev/ic/an.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index 80c20a42765..0d22dca1ed6 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.28 2003/08/15 20:32:16 tedu Exp $ */ +/* $OpenBSD: an.c,v 1.29 2003/09/19 00:27:02 avsm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -240,10 +240,16 @@ an_attach(sc) ifp->if_baudrate = 10000000; IFQ_SET_READY(&ifp->if_snd); + if (sizeof(sc->an_config.an_nodename) < sizeof(AN_DEFAULT_NODENAME)) + panic("AN_DEFAULT_NODENAME too long"); + bzero(sc->an_config.an_nodename, sizeof(sc->an_config.an_nodename)); bcopy(AN_DEFAULT_NODENAME, sc->an_config.an_nodename, sizeof(AN_DEFAULT_NODENAME) - 1); + if (sizeof(sc->an_ssidlist.an_ssid1) < sizeof(AN_DEFAULT_NETNAME)) + panic("AN_DEFAULT_NETNAME too long"); + bzero(sc->an_ssidlist.an_ssid1, sizeof(sc->an_ssidlist.an_ssid1)); bcopy(AN_DEFAULT_NETNAME, sc->an_ssidlist.an_ssid1, sizeof(AN_DEFAULT_NETNAME) - 1); |