diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-09-19 00:27:03 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-09-19 00:27:03 +0000 |
commit | 709dddeae933d9476251e92612b7ee47a7d9f833 (patch) | |
tree | 94598db36947cdbb96060c6adfde41e3150013ea /sys/dev/ic | |
parent | 4acfe76abe7c1bb638c337a44f9e0c5ddb63c6fc (diff) |
Put in a couple of sanity checks to ensure that the AN_DEFAULT_*
variables arent defined too large.
itojun@ ok
Diffstat (limited to 'sys/dev/ic')
-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); |