diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-06-18 22:27:42 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-06-18 22:27:42 +0000 |
commit | b49d6243b6fe9e56b4addd753feb0635c19ae1d4 (patch) | |
tree | 9bb020ba21c11c1a1a2e98aa7987390286d4af2a /sbin/ancontrol | |
parent | 9461946ff9a0e528add223a3a0fef24fcc2a3c8d (diff) |
Fix more buffer overflows... that's 5 in this one program (so far)
Diffstat (limited to 'sbin/ancontrol')
-rw-r--r-- | sbin/ancontrol/ancontrol.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/sbin/ancontrol/ancontrol.c b/sbin/ancontrol/ancontrol.c index 74c6ebf5b39..8b4517804e2 100644 --- a/sbin/ancontrol/ancontrol.c +++ b/sbin/ancontrol/ancontrol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ancontrol.c,v 1.3 2000/06/18 20:44:33 aaron Exp $ */ +/* $OpenBSD: ancontrol.c,v 1.4 2000/06/18 22:27:41 aaron Exp $ */ /* * Copyright 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -1024,24 +1024,21 @@ an_setssid(iface, act, arg) an_getval(iface, &areq); ssid = (struct an_ltv_ssidlist *)&areq; - switch(act) { + switch (act) { case ACT_SET_SSID1: bzero(ssid->an_ssid1, sizeof(ssid->an_ssid1)); - bcopy((char *)arg, (char *)&ssid->an_ssid1, - strlen((char *)arg)); - ssid->an_ssid1_len = strlen((char *)arg); + strlcpy(ssid->an_ssid1, (char *)arg, sizeof(ssid->an_ssid1)); + ssid->an_ssid1_len = strlen(ssid->an_ssid1); break; case ACT_SET_SSID2: bzero(ssid->an_ssid2, sizeof(ssid->an_ssid2)); - bcopy((char *)arg, (char *)&ssid->an_ssid2, - strlen((char *)arg)); - ssid->an_ssid2_len = strlen((char *)arg); + strlcpy(ssid->an_ssid2, (char *)arg, sizeof(ssid->an_ssid2)); + ssid->an_ssid2_len = strlen(ssid->an_ssid2); break; case ACT_SET_SSID3: bzero(ssid->an_ssid3, sizeof(ssid->an_ssid3)); - bcopy((char *)arg, (char *)&ssid->an_ssid3, - strlen((char *)arg)); - ssid->an_ssid3_len = strlen((char *)arg); + strlcpy(ssid->an_ssid3, (char *)arg, sizeof(ssid->an_ssid3)); + ssid->an_ssid3_len = strlen(ssid->an_ssid3); break; default: errx(1, "unknown action"); |