diff options
Diffstat (limited to 'sys/arch')
22 files changed, 83 insertions, 81 deletions
diff --git a/sys/arch/hp300/stand/libkern/Makefile b/sys/arch/hp300/stand/libkern/Makefile index d7f70c51ee2..587a9c18882 100644 --- a/sys/arch/hp300/stand/libkern/Makefile +++ b/sys/arch/hp300/stand/libkern/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 1997/07/15 07:52:21 downsj Exp $ +# $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:34 deraadt Exp $ LIB= kern @@ -12,8 +12,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \ -I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libkern # kern routines -SRCS= __main.c ashrdi3.c divdi3.c qdivrem.c strlen.S strcat.S strcmp.S \ - strcpy.S strncmp.S umoddi3.c +SRCS= __main.c ashrdi3.c divdi3.c qdivrem.c strlen.S strcmp.S \ + strncmp.S umoddi3.c ${OBJS}: ${.CURDIR}/../Makefile.inc diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile index 0cbacace464..0b823aa4e2a 100644 --- a/sys/arch/hp300/stand/libsa/Makefile +++ b/sys/arch/hp300/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.12 1999/08/16 09:43:09 downsj Exp $ +# $OpenBSD: Makefile,v 1.13 2003/06/01 17:00:34 deraadt Exp $ LIB= sa @@ -11,7 +11,7 @@ CFLAGS= -O2 -msoft-float \ # stand routines SRCS= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \ - memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c + memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ diff --git a/sys/arch/hp300/stand/libsaz/Makefile b/sys/arch/hp300/stand/libsaz/Makefile index 116f29a52c2..e7d14dd138f 100644 --- a/sys/arch/hp300/stand/libsaz/Makefile +++ b/sys/arch/hp300/stand/libsaz/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 1999/08/16 09:43:10 downsj Exp $ +# $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:34 deraadt Exp $ LIB= saz @@ -11,7 +11,7 @@ CFLAGS= -O2 -msoft-float -D__INTERNAL_LIBSA_CREAD \ # stand routines SRCS= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \ - memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c + memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.c b/sys/arch/hppa/stand/libsa/dev_hppa.c index 6d720ef753a..932b7fe227f 100644 --- a/sys/arch/hppa/stand/libsa/dev_hppa.c +++ b/sys/arch/hppa/stand/libsa/dev_hppa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_hppa.c,v 1.8 2003/04/16 07:20:50 mickey Exp $ */ +/* $OpenBSD: dev_hppa.c,v 1.9 2003/06/01 17:00:34 deraadt Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -219,7 +219,8 @@ char * ttyname(fd) int fd; { - sprintf(ttyname_buf, "%s%d", cdevs[major(cn_tab->cn_dev)], + snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d", + cdevs[major(cn_tab->cn_dev)], minor(cn_tab->cn_dev)); return (ttyname_buf); } diff --git a/sys/arch/i386/stand/libsa/Makefile b/sys/arch/i386/stand/libsa/Makefile index a40af3711b4..22d48c315ed 100644 --- a/sys/arch/i386/stand/libsa/Makefile +++ b/sys/arch/i386/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.40 2003/04/17 03:43:18 drahn Exp $ +# $OpenBSD: Makefile,v 1.41 2003/06/01 17:00:35 deraadt Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -28,8 +28,8 @@ CLEANFILES+= unixdev.o unixsys.o nullfs.o # stand routines SRCS+= alloc.c exit.c getfile.c gets.c globals.c strcmp.c strlen.c \ - strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c \ - strtol.c ctime.c + strncmp.c memcmp.c memcpy.c memset.c printf.c snprintf.c \ + strerror.c strncpy.c strtol.c ctime.c strlcpy.c strlcat.c # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ diff --git a/sys/arch/i386/stand/libsa/dev_i386.c b/sys/arch/i386/stand/libsa/dev_i386.c index 86817886fcc..8389c3a26e8 100644 --- a/sys/arch/i386/stand/libsa/dev_i386.c +++ b/sys/arch/i386/stand/libsa/dev_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_i386.c,v 1.24 2001/09/11 06:06:15 fgsch Exp $ */ +/* $OpenBSD: dev_i386.c,v 1.25 2003/06/01 17:00:35 deraadt Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -167,7 +167,8 @@ char * ttyname(fd) int fd; { - sprintf(ttyname_buf, "%s%d", cdevs[major(cn_tab->cn_dev)], + snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d", + cdevs[major(cn_tab->cn_dev)], minor(cn_tab->cn_dev)); return (ttyname_buf); } diff --git a/sys/arch/macppc/stand/boot.c b/sys/arch/macppc/stand/boot.c index 14b94c818b3..c1af395f2cc 100644 --- a/sys/arch/macppc/stand/boot.c +++ b/sys/arch/macppc/stand/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.8 2002/09/15 09:01:59 deraadt Exp $ */ +/* $OpenBSD: boot.c,v 1.9 2003/06/01 17:00:36 deraadt Exp $ */ /* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */ /* @@ -181,9 +181,9 @@ main() /* * Get the boot arguments from Openfirmware */ - if ((chosen = OF_finddevice("/chosen")) == -1 - || OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 - || OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { + if ((chosen = OF_finddevice("/chosen")) == -1 || + OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 || + OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { printf("Invalid Openfirmware environment\n"); exit(); } @@ -206,7 +206,7 @@ main() OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1); cp = bootline; #else - strcpy(bootline, opened_name); + strlcpy(bootline, opened_name, sizeof bootline); cp = bootline + strlen(bootline); *cp++ = ' '; #endif @@ -234,7 +234,7 @@ main() ssym = (void *)marks[MARK_SYM]; esym = (void *)marks[MARK_END]; - chain ((void *)entry, bootline, ssym, esym); + chain((void *)entry, bootline, ssym, esym); _rtt(); return 0; diff --git a/sys/arch/macppc/stand/hfs.c b/sys/arch/macppc/stand/hfs.c index de677b7fe74..da3116e3297 100644 --- a/sys/arch/macppc/stand/hfs.c +++ b/sys/arch/macppc/stand/hfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hfs.c,v 1.1 2001/09/01 15:39:02 drahn Exp $ */ +/* $OpenBSD: hfs.c,v 1.2 2003/06/01 17:00:36 deraadt Exp $ */ /* $NetBSD: hfs.c,v 1.1 2000/11/14 11:25:35 tsubai Exp $ */ /*- @@ -44,7 +44,6 @@ hfs_open(path, f) int chosen; char bootpath[128], *cp; - if ((chosen = OF_finddevice("/chosen")) == -1) return ENXIO; bzero(bootpath, sizeof bootpath); @@ -54,7 +53,7 @@ hfs_open(path, f) cp = strrchr(bootpath, ','); #else cp = bootpath; - cp += strlen (bootpath); + cp += strlen(bootpath); for (; *cp != ','; cp--) { if (cp == bootpath) { cp = NULL; @@ -65,11 +64,10 @@ hfs_open(path, f) if (cp == NULL) return ENXIO; - strcpy(cp + 1, path); + strlcpy(cp + 1, path, bootpath + sizeof bootpath - (cp + 1)); OF_fd = OF_open(bootpath); if (OF_fd == -1) return ENOENT; - return 0; } diff --git a/sys/arch/mvme68k/stand/installboot/installboot.c b/sys/arch/mvme68k/stand/installboot/installboot.c index 9d75b14e384..c8403cdf62e 100644 --- a/sys/arch/mvme68k/stand/installboot/installboot.c +++ b/sys/arch/mvme68k/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.7 2002/03/14 03:15:56 millert Exp $ */ +/* $OpenBSD: installboot.c,v 1.8 2003/06/01 17:00:36 deraadt Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -121,7 +121,7 @@ main(argc, argv) boot = argv[optind]; proto = argv[optind + 1]; dev = argv[optind + 2]; - strcpy(cdev, dev); + strlcpy(cdev, dev, sizeof cdev); cdev[strlen(cdev)-1] = 'c'; if (verbose) { diff --git a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c b/sys/arch/mvme68k/stand/wrtvid/wrtvid.c index fe4f65d9efd..e9b4b98f230 100644 --- a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c +++ b/sys/arch/mvme68k/stand/wrtvid/wrtvid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wrtvid.c,v 1.3 1996/04/28 10:49:49 deraadt Exp $ */ +/* $OpenBSD: wrtvid.c,v 1.4 2003/06/01 17:00:37 deraadt Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -35,15 +35,15 @@ main(argc, argv) perror(filename); exit(2); } - sprintf(fileext, "%c%cboot", filename[4], filename[5]); + snprintf(fileext, sizeof fileext, "%c%cboot", filename[4], filename[5]); tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644); - sprintf(fileext, "boot%c%c", filename[4], filename[5]); + snprintf(fileext, sizeof fileext, "boot%c%c", filename[4], filename[5]); tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644); pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel)); bzero(pcpul, sizeof(struct cpu_disklabel)); - strcpy(pcpul->vid_id, "NBSD"); + memcpy(pcpul->vid_id, "NBSD", sizeof pcpul->vid_id); fstat(exe_file, &stat); /* size in 256 byte blocks round up after a.out header removed */ diff --git a/sys/arch/mvme88k/stand/installboot/installboot.c b/sys/arch/mvme88k/stand/installboot/installboot.c index 19fc29f7f66..760a5d32ee8 100644 --- a/sys/arch/mvme88k/stand/installboot/installboot.c +++ b/sys/arch/mvme88k/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.6 2002/03/14 03:15:57 millert Exp $ */ +/* $OpenBSD: installboot.c,v 1.7 2003/06/01 17:00:37 deraadt Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -121,7 +121,7 @@ main(argc, argv) boot = argv[optind]; proto = argv[optind + 1]; dev = argv[optind + 2]; - strcpy(cdev, dev); + strlcpy(cdev, dev, sizeof cdev); cdev[strlen(cdev)-1] = 'c'; if (verbose) { @@ -423,7 +423,7 @@ char *bootproto; pcpul->version = 1; - strcpy(pcpul->vid_id, "M88K"); + memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id); fstat(exe_file, &stat); diff --git a/sys/arch/mvme88k/stand/wrtvid/wrtvid.c b/sys/arch/mvme88k/stand/wrtvid/wrtvid.c index 420ff803c6f..cc27853dcc2 100644 --- a/sys/arch/mvme88k/stand/wrtvid/wrtvid.c +++ b/sys/arch/mvme88k/stand/wrtvid/wrtvid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wrtvid.c,v 1.3 1998/08/22 08:52:56 smurph Exp $ */ +/* $OpenBSD: wrtvid.c,v 1.4 2003/06/01 17:00:37 deraadt Exp $ */ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -38,16 +38,16 @@ main(argc, argv) perror(filename); exit(2); } - sprintf(fileext, "%c%cboot", filename[4], filename[5]); + snprintf(fileext, sizeof fileext, "%c%cboot", filename[4], filename[5]); tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644); - sprintf(fileext, "boot%c%c", filename[4], filename[5]); + snprintf(fileext, sizeof fileext, "boot%c%c", filename[4], filename[5]); tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644); pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel)); bzero(pcpul, sizeof(struct cpu_disklabel)); pcpul->version = 1; - strcpy(pcpul->vid_id, "M88K"); + memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id); fstat(exe_file, &stat); /* size in 256 byte blocks round up after a.out header removed */ diff --git a/sys/arch/mvmeppc/stand/installboot/installboot.c b/sys/arch/mvmeppc/stand/installboot/installboot.c index 813ca3042dc..9f0fc87c189 100644 --- a/sys/arch/mvmeppc/stand/installboot/installboot.c +++ b/sys/arch/mvmeppc/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.4 2002/03/14 03:15:58 millert Exp $ */ +/* $OpenBSD: installboot.c,v 1.5 2003/06/01 17:00:38 deraadt Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -121,7 +121,7 @@ main(argc, argv) boot = argv[optind]; proto = argv[optind + 1]; dev = argv[optind + 2]; - strcpy(cdev, dev); + strlcpy(cdev, dev, sizeof cdev); cdev[strlen(cdev)-1] = 'c'; if (verbose) { @@ -423,7 +423,7 @@ char *bootproto; pcpul->version = 1; - strcpy(pcpul->vid_id, "M88K"); + memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id); fstat(exe_file, &stat); diff --git a/sys/arch/mvmeppc/stand/libsa/Makefile b/sys/arch/mvmeppc/stand/libsa/Makefile index 3c8b70fa1ea..4e8cad5fd99 100644 --- a/sys/arch/mvmeppc/stand/libsa/Makefile +++ b/sys/arch/mvmeppc/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2001/06/26 21:58:06 smurph Exp $ +# $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:38 deraadt Exp $ LIB=sa @@ -21,7 +21,7 @@ SRC_sa= alloc.c memcpy.c exit.c getfile.c gets.c globals.c \ lseek.c open.c nullfs.c read.c fstat.c \ ufs.c cread.c -SRC_kern= ashrdi3.c bzero.c strcpy.c +SRC_kern= ashrdi3.c bzero.c SRC_mvme= exec_mvme.c diff --git a/sys/arch/mvmeppc/stand/libsa/bugdev.c b/sys/arch/mvmeppc/stand/libsa/bugdev.c index b3a8c8bce27..7943924c56b 100644 --- a/sys/arch/mvmeppc/stand/libsa/bugdev.c +++ b/sys/arch/mvmeppc/stand/libsa/bugdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bugdev.c,v 1.1 2001/06/26 21:58:07 smurph Exp $ */ +/* $OpenBSD: bugdev.c,v 1.2 2003/06/01 17:00:38 deraadt Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -425,7 +425,8 @@ retry: printf(" IO @ %x\n", io); printf("MEM @ %x\n", mem); -#define PRINT_REG(regname, x) printf("%s = 0x%x\n", regname, md_swap_long(*(unsigned *)(io + x))) +#define PRINT_REG(regname, x) printf("%s = 0x%x\n", regname, \ + md_swap_long(*(unsigned *)(io + x))) PRINT_REG("CSR0", 0x00); PRINT_REG("CSR1", 0x08); @@ -472,19 +473,21 @@ net_open(struct open_file *f, ...) va_end(ap); #ifdef DEBUG - printf("net_open: using mvmebug ctrl %d dev %d, filename: %s\n", pp->clun, pp->dlun, filename); + printf("net_open: using mvmebug ctrl %d dev %d, filename: %s\n", + pp->clun, pp->dlun, filename); #endif nfo.clun = pp->clun; nfo.dlun = pp->dlun; nfo.status = 0; - strcpy(nfo.filename, filename); + strlcpy(nfo.filename, filename, sizeof filename); /* .NETFOPN syscall */ mvmeprom_netfopen(&nfo); #ifdef DEBUG if (nfo.status) { nfoerr = nfo.status; - printf("net_open: ci err = 0x%x, cd err = 0x%x\n", ((nfoerr >> 8) & 0x0F), (nfoerr & 0x0F)); + printf("net_open: ci err = 0x%x, cd err = 0x%x\n", + ((nfoerr >> 8) & 0x0F), (nfoerr & 0x0F)); } #endif return (nfo.status); diff --git a/sys/arch/mvmeppc/stand/libsa/tftpfs.c b/sys/arch/mvmeppc/stand/libsa/tftpfs.c index 9e6a3c9e8e2..42f897506df 100644 --- a/sys/arch/mvmeppc/stand/libsa/tftpfs.c +++ b/sys/arch/mvmeppc/stand/libsa/tftpfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftpfs.c,v 1.2 2002/03/14 01:26:41 millert Exp $ */ +/* $OpenBSD: tftpfs.c,v 1.3 2003/06/01 17:00:38 deraadt Exp $ */ /*- * Copyright (c) 2001 Steve Murphree, Jr. @@ -119,7 +119,7 @@ tftp_read_file(f, buf_p, size_p) * and start again. */ char filename[64]; - strcpy(filename, fp->filename); + strlcpy(filename, fp->filename, sizeof filename); tftpfs_close(f); tftpfs_open(filename, f); for (i = 1; i <= file_block; i++) { @@ -171,7 +171,7 @@ tftpfs_open(path, f) bzero(fp->f_buf, TFTP_BLOCK_SIZE); fp->f_buf_size = 0; - strcpy(fp->filename, path); + strlcpy(fp->filename, path, sizeof fp->filename); if (f->f_dev->dv_open == NULL) { panic("No device open()!"); diff --git a/sys/arch/sparc/stand/common/promdev.c b/sys/arch/sparc/stand/common/promdev.c index 54ae9041910..719c162e818 100644 --- a/sys/arch/sparc/stand/common/promdev.c +++ b/sys/arch/sparc/stand/common/promdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: promdev.c,v 1.7 2002/08/15 15:41:35 millert Exp $ */ +/* $OpenBSD: promdev.c,v 1.8 2003/06/01 17:00:39 deraadt Exp $ */ /* $NetBSD: promdev.c,v 1.16 1995/11/14 15:04:01 pk Exp $ */ /* @@ -534,7 +534,7 @@ prom_getether(fd, ea) (void)(*promvec->pv_enaddr)(fd, (char *)ea); } else { char buf[64]; - sprintf(buf, "%x mac-address drop swap 6 cmove", ea); + snprintf(buf, sizeof buf, "%x mac-address drop swap 6 cmove", ea); promvec->pv_fortheval.v2_eval(buf); } } diff --git a/sys/arch/sparc/stand/libkern/Makefile b/sys/arch/sparc/stand/libkern/Makefile index 594e0c0da47..d739830daef 100644 --- a/sys/arch/sparc/stand/libkern/Makefile +++ b/sys/arch/sparc/stand/libkern/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 1999/12/10 10:40:47 deraadt Exp $ +# $OpenBSD: Makefile,v 1.3 2003/06/01 17:00:39 deraadt Exp $ LIB= kern @@ -16,8 +16,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \ -I${.CURDIR}/../../../../lib/libkern/arch/sparc # kern routines -SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S strcat.c \ - strcmp.c strcpy.c strncmp.c umoddi3.c +SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S \ + strcmp.c strncmp.c umoddi3.c SRCS+= umul.S mul.S rem.S sdiv.S udiv.S urem.S SRCS+= saveregs.S diff --git a/sys/arch/sparc/stand/libsa/Makefile b/sys/arch/sparc/stand/libsa/Makefile index 68e3495cf31..0002c987e1a 100644 --- a/sys/arch/sparc/stand/libsa/Makefile +++ b/sys/arch/sparc/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 1997/09/17 10:46:23 downsj Exp $ +# $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:39 deraadt Exp $ LIB= sa @@ -11,7 +11,7 @@ CFLAGS= -O2 -D__INTERNAL_LIBSA_CREAD \ # stand routines SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c \ - memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c + memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ diff --git a/sys/arch/sparc64/stand/libkern/Makefile b/sys/arch/sparc64/stand/libkern/Makefile index d49b2a7bc58..3eb6bb9a2c8 100644 --- a/sys/arch/sparc64/stand/libkern/Makefile +++ b/sys/arch/sparc64/stand/libkern/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2003/04/09 10:35:04 sturm Exp $ +# $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:39 deraadt Exp $ LIB= kern @@ -16,8 +16,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \ -I${.CURDIR}/../../../../lib/libkern/arch/sparc # kern routines -SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S strcat.c \ - strcmp.c strcpy.c strlcat.c strlcpy.c strncmp.c umoddi3.c +SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S \ + strcmp.c strlcat.c strlcpy.c strncmp.c umoddi3.c SRCS+= umul.S mul.S rem.S sdiv.S udiv.S urem.S SRCS+= saveregs.S diff --git a/sys/arch/sparc64/stand/libsa/Makefile b/sys/arch/sparc64/stand/libsa/Makefile index 4c92556a661..fd55dd6063f 100644 --- a/sys/arch/sparc64/stand/libsa/Makefile +++ b/sys/arch/sparc64/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2001/10/10 20:41:40 miod Exp $ +# $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:40 deraadt Exp $ LIB= sa @@ -16,7 +16,7 @@ CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD # stand routines SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c \ - memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c + memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ diff --git a/sys/arch/sparc64/stand/ofwboot/boot.c b/sys/arch/sparc64/stand/ofwboot/boot.c index 9a2b3378256..0ab68c0218f 100644 --- a/sys/arch/sparc64/stand/ofwboot/boot.c +++ b/sys/arch/sparc64/stand/ofwboot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.7 2003/05/11 20:22:20 mdw Exp $ */ +/* $OpenBSD: boot.c,v 1.8 2003/06/01 17:00:40 deraadt Exp $ */ /* $NetBSD: boot.c,v 1.3 2001/05/31 08:55:19 mrg Exp $ */ /* * Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved. @@ -209,7 +209,7 @@ chain(pentry, args, ssym, esym) #ifdef DEBUG printf("chain: calling OF_chain(%x, %x, %x, %x, %x)\n", - (void *)RELOC, end - (char *)RELOC, entry, args, l); + (void *)RELOC, end - (char *)RELOC, entry, args, l); #endif /* if -D is set then pause in the PROM. */ if (debug > 1) OF_enter(); @@ -248,7 +248,7 @@ loadfile(fd, args) printf("read header: %s\n", strerror(errno)); else printf("read header: short read (only %d of %d)\n", - rval, sizeof(hdr)); + rval, sizeof(hdr)); rval = 1; goto err; } @@ -263,8 +263,7 @@ loadfile(fd, args) if (bcmp(hdr.elf32.e_ident, ELFMAG, SELFMAG) == 0 && hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) { rval = elf32_exec(fd, &hdr.elf32, &entry, &ssym, &esym); - } else - if (bcmp(hdr.elf64.e_ident, ELFMAG, SELFMAG) == 0 && + } else if (bcmp(hdr.elf64.e_ident, ELFMAG, SELFMAG) == 0 && hdr.elf64.e_ident[EI_CLASS] == ELFCLASS64) { rval = elf64_exec(fd, &hdr.elf64, &entry, &ssym, &esym); } else @@ -476,8 +475,8 @@ elf32_exec(fd, elf, entryp, ssymp, esymp) for (i = 0; i < elf->e_shnum; i++, shp++) { if (shp->sh_type == SHT_NULL) continue; - if (shp->sh_type != SHT_SYMTAB - && shp->sh_type != SHT_STRTAB) { + if (shp->sh_type != SHT_SYMTAB && + shp->sh_type != SHT_STRTAB) { shp->sh_offset = 0; shp->sh_type = SHT_NOBITS; continue; @@ -511,8 +510,8 @@ elf32_exec(fd, elf, entryp, ssymp, esymp) addr += sizeof(Elf32_Ehdr) + (elf->e_shnum * sizeof(Elf32_Shdr)); off = sizeof(Elf32_Ehdr) + (elf->e_shnum * sizeof(Elf32_Shdr)); for (first = 1, i = 0; i < elf->e_shnum; i++, shp++) { - if (shp->sh_type == SHT_SYMTAB - || shp->sh_type == SHT_STRTAB) { + if (shp->sh_type == SHT_SYMTAB || + shp->sh_type == SHT_STRTAB) { if (first) printf("symbols @ 0x%lx ", (u_long)addr); printf("%s%d", first ? "" : "+", shp->sh_size); @@ -552,9 +551,9 @@ main() /* * Get the boot arguments from Openfirmware */ - if ((chosen = OF_finddevice("/chosen")) == -1 - || OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 - || OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { + if ((chosen = OF_finddevice("/chosen")) == -1 || + OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 || + OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { printf("Invalid Openfirmware environment\n"); exit(); } @@ -569,8 +568,8 @@ main() */ bootlp = kernels; - if (parseargs(bootline, &boothowto) == -1 - || (boothowto & RB_ASKNAME)) { + if (parseargs(bootline, &boothowto) == -1 || + (boothowto & RB_ASKNAME)) { bootlp = 0; } else if (*bootline) { just_bootline[0] = bootline; @@ -586,7 +585,7 @@ main() kernels[0] = 0; /* no more iteration */ } else if (cp != bootline) { printf(": trying %s...\n", cp); - strcpy(bootline, cp); + strlcpy(bootline, cp, sizeof bootline); } } if (!bootlp) { @@ -598,8 +597,8 @@ main() bootlp = kernels; continue; } - if (strcmp(bootline, "exit") == 0 - || strcmp(bootline, "halt") == 0) { + if (strcmp(bootline, "exit") == 0 || + strcmp(bootline, "halt") == 0) { _rtt(); } } @@ -611,7 +610,7 @@ main() OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1); cp = bootline; #else - strcpy(bootline, opened_name); + strlcpy(bootline, opened_name, sizeof bootline); cp = bootline + strlen(bootline); *cp++ = ' '; #endif |