summaryrefslogtreecommitdiffstats
path: root/sys/dev/aha
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>1998-12-04 22:54:57 +0000
committerarchie <archie@FreeBSD.org>1998-12-04 22:54:57 +0000
commit982e80577dd08945aa2345ebe35e3f50eef9eb48 (patch)
treee21ff4cbfbcb4097c6cc444d68ddd9a3fd37837f /sys/dev/aha
parent707b8f68aa118c7396f2a2633751e32477d9ed08 (diff)
downloadFreeBSD-src-982e80577dd08945aa2345ebe35e3f50eef9eb48.zip
FreeBSD-src-982e80577dd08945aa2345ebe35e3f50eef9eb48.tar.gz
Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc. These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer. Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
Diffstat (limited to 'sys/dev/aha')
-rw-r--r--sys/dev/aha/aha.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/aha/aha.c b/sys/dev/aha/aha.c
index e892865..0fe69c0 100644
--- a/sys/dev/aha/aha.c
+++ b/sys/dev/aha/aha.c
@@ -55,7 +55,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aha.c,v 1.12 1998/11/10 06:47:09 gibbs Exp $
+ * $Id: aha.c,v 1.13 1998/11/25 19:12:56 imp Exp $
*/
#include <sys/param.h>
@@ -388,31 +388,31 @@ aha_fetch_adapter_info(struct aha_softc *aha)
switch (aha->boardid) {
case BOARD_1540_16HEAD_BIOS:
- strcpy(aha->model, "1540 16 head BIOS");
+ snprintf(aha->model, sizeof(aha->model), "1540 16 head BIOS");
break;
case BOARD_1540_64HEAD_BIOS:
- strcpy(aha->model, "1540 64 head BIOS");
+ snprintf(aha->model, sizeof(aha->model), "1540 64 head BIOS");
break;
case BOARD_1542:
- strcpy(aha->model, "1540/1542 64 head BIOS");
+ snprintf(aha->model, sizeof(aha->model), "1540/1542 64 head BIOS");
break;
case BOARD_1640:
- strcpy(aha->model, "1640");
+ snprintf(aha->model, sizeof(aha->model), "1640");
break;
case BOARD_1740:
- strcpy(aha->model, "1740A/1742A/1744");
+ snprintf(aha->model, sizeof(aha->model), "1740A/1742A/1744");
break;
case BOARD_1542C:
- strcpy(aha->model, "1542C");
+ snprintf(aha->model, sizeof(aha->model), "1542C");
break;
case BOARD_1542CF:
- strcpy(aha->model, "1542CF");
+ snprintf(aha->model, sizeof(aha->model), "1542CF");
break;
case BOARD_1542CP:
- strcpy(aha->model, "1542CP");
+ snprintf(aha->model, sizeof(aha->model), "1542CP");
break;
default:
- strcpy(aha->model, "Unknown");
+ snprintf(aha->model, sizeof(aha->model), "Unknown");
break;
}
/*
@@ -663,7 +663,7 @@ aha_name(struct aha_softc *aha)
{
static char name[10];
- sprintf(name, "aha%d", aha->unit);
+ snprintf(name, sizeof(name), "aha%d", aha->unit);
return (name);
}
OpenPOWER on IntegriCloud