summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-11-16 19:33:53 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-11-16 19:33:53 +0000
commit3e5ba3a87697f1d75a384fba7d33282b0efbc56d (patch)
tree596acb56b9a6671617dadbd62f984b37f808e5eb /sys/arch
parent36e49efc8023dbd9e7ceb0d59d483be68658ce63 (diff)
Replace unbounded gets() in libsa with getln() which takes a buffer size,
and convert all gets() users. ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/stand/pxeboot/Makefile9
-rw-r--r--sys/arch/aviion/stand/boot/boot.c4
-rw-r--r--sys/arch/aviion/stand/libsa/Makefile4
-rw-r--r--sys/arch/hppa/stand/libsa/Makefile4
-rw-r--r--sys/arch/hppa64/stand/libsa/Makefile4
-rw-r--r--sys/arch/loongson/stand/libsa/Makefile4
-rw-r--r--sys/arch/octeon/stand/libsa/Makefile4
-rw-r--r--sys/arch/sgi/stand/libsa/Makefile4
-rw-r--r--sys/arch/sparc/stand/boot/boot.c6
-rw-r--r--sys/arch/sparc/stand/libsa/Makefile4
-rw-r--r--sys/arch/sparc64/stand/libsa/Makefile4
-rw-r--r--sys/arch/sparc64/stand/ofwboot/boot.c10
-rw-r--r--sys/arch/vax/stand/boot/boot.c4
13 files changed, 33 insertions, 32 deletions
diff --git a/sys/arch/amd64/stand/pxeboot/Makefile b/sys/arch/amd64/stand/pxeboot/Makefile
index 31af8e5b581..ddf2880edea 100644
--- a/sys/arch/amd64/stand/pxeboot/Makefile
+++ b/sys/arch/amd64/stand/pxeboot/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.24 2015/09/02 01:52:26 yasuoka Exp $
+# $OpenBSD: Makefile,v 1.25 2015/11/16 19:33:52 miod Exp $
MAN= pxeboot.8
@@ -27,9 +27,10 @@ SRCS+= softraid.c
SRCS+= boot.c cmd.c vars.c bootarg.c
.PATH: ${S}/lib/libsa
-SRCS+= alloc.c exit.c getchar.c getfile.c gets.c globals.c putchar.c strcmp.c \
- strlen.c strncmp.c memcmp.c memcpy.c memset.c printf.c snprintf.c \
- strerror.c strncpy.c strtol.c strtoll.c ctime.c strlcpy.c strlcat.c
+SRCS+= alloc.c exit.c getchar.c getfile.c getln.c globals.c putchar.c \
+ strcmp.c strlen.c strncmp.c memcmp.c memcpy.c memset.c printf.c \
+ snprintf.c strerror.c strncpy.c strtol.c strtoll.c ctime.c strlcpy.c \
+ strlcat.c
SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
diff --git a/sys/arch/aviion/stand/boot/boot.c b/sys/arch/aviion/stand/boot/boot.c
index 25f8d36a42f..fd2dc5476a8 100644
--- a/sys/arch/aviion/stand/boot/boot.c
+++ b/sys/arch/aviion/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.5 2014/02/24 20:15:37 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.6 2015/11/16 19:33:52 miod Exp $ */
/*-
* Copyright (c) 1995 Theo de Raadt
@@ -109,7 +109,7 @@ boot(const char *args, uint bootdev, uint bootunit, uint bootlun)
for (;;) {
if (ask != 0) {
printf("boot: ");
- gets(line);
+ getln(line, sizeof line);
if (line[0] == '\0')
continue;
diff --git a/sys/arch/aviion/stand/libsa/Makefile b/sys/arch/aviion/stand/libsa/Makefile
index eff44aa59e6..977ba6c9721 100644
--- a/sys/arch/aviion/stand/libsa/Makefile
+++ b/sys/arch/aviion/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.6 2014/11/19 20:01:35 miod Exp $
+# $OpenBSD: Makefile,v 1.7 2015/11/16 19:33:52 miod Exp $
LIB=sa
@@ -12,7 +12,7 @@ S=${.CURDIR}/../../../..
SRCS= clock.c delay.S exec.c fault.c parse_args.c setjmp.S
.PATH: ${S}/lib/libsa
-SRCS+= alloc.c memcpy.c exit.c getfile.c gets.c globals.c loadfile.c \
+SRCS+= alloc.c memcpy.c exit.c getfile.c getln.c globals.c loadfile.c \
printf.c strerror.c memset.c memcmp.c strncpy.c strcmp.c strlen.c \
strlcpy.c strlcat.c snprintf.c strchr.c strtol.c \
close.c closeall.c dev.c dkcksum.c \
diff --git a/sys/arch/hppa/stand/libsa/Makefile b/sys/arch/hppa/stand/libsa/Makefile
index 71eeca4469b..58cc74111a4 100644
--- a/sys/arch/hppa/stand/libsa/Makefile
+++ b/sys/arch/hppa/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.19 2014/07/13 09:26:08 jasper Exp $
+# $OpenBSD: Makefile,v 1.20 2015/11/16 19:33:52 miod Exp $
.include "${.CURDIR}/../Makefile.inc"
@@ -20,7 +20,7 @@ SRCS= machdep.c pdc.c itecons.c dev_hppa.c time.c \
ct.c dk.c lf.c lif.c cmd_hppa.c loadfile.c elf32.c elf64.c
# stand routines
-SRCS+= alloc.c exit.c getfile.c gets.c getchar.c globals.c \
+SRCS+= alloc.c exit.c getfile.c getln.c getchar.c globals.c \
printf.c putchar.c strerror.c strtol.c strchr.c ctime.c snprintf.c
# io routines
diff --git a/sys/arch/hppa64/stand/libsa/Makefile b/sys/arch/hppa64/stand/libsa/Makefile
index 8ce85ee55e1..09595e17907 100644
--- a/sys/arch/hppa64/stand/libsa/Makefile
+++ b/sys/arch/hppa64/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.5 2014/07/13 09:26:08 jasper Exp $
+# $OpenBSD: Makefile,v 1.6 2015/11/16 19:33:52 miod Exp $
.include "${.CURDIR}/../Makefile.inc"
@@ -21,7 +21,7 @@ SRCS= machdep.c pdc.c itecons.c dev_hppa64.c time.c \
ct.c dk.c lf.c lif.c cmd_hppa64.c
# stand routines
-SRCS+= alloc.c exit.c getfile.c gets.c getchar.c globals.c \
+SRCS+= alloc.c exit.c getfile.c getln.c getchar.c globals.c \
printf.c putchar.c strerror.c strtol.c strchr.c ctime.c loadfile.c \
snprintf.c
diff --git a/sys/arch/loongson/stand/libsa/Makefile b/sys/arch/loongson/stand/libsa/Makefile
index de176e7e5d0..844b3333cfb 100644
--- a/sys/arch/loongson/stand/libsa/Makefile
+++ b/sys/arch/loongson/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.6 2014/07/13 09:26:08 jasper Exp $
+# $OpenBSD: Makefile,v 1.7 2015/11/16 19:33:52 miod Exp $
.include "${.CURDIR}/../Makefile.inc"
@@ -16,7 +16,7 @@ CFLAGS+= ${CEXTRAFLAGS} ${SAABI} -nostdinc -mno-abicalls -D_NO_ABICALLS \
-I${.OBJDIR}
# stand routines
-SRCS= alloc.c cons.c ctime.c exit.c getchar.c getfile.c gets.c globals.c \
+SRCS= alloc.c cons.c ctime.c exit.c getchar.c getfile.c getln.c globals.c \
memcmp.c memcpy.c memset.c printf.c putchar.c \
snprintf.c strchr.c strcmp.c strerror.c strncmp.c strncpy.c strtol.c
diff --git a/sys/arch/octeon/stand/libsa/Makefile b/sys/arch/octeon/stand/libsa/Makefile
index 3b8c9eff256..ed14a0e2aba 100644
--- a/sys/arch/octeon/stand/libsa/Makefile
+++ b/sys/arch/octeon/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.4 2014/07/13 09:26:08 jasper Exp $
+# $OpenBSD: Makefile,v 1.5 2015/11/16 19:33:52 miod Exp $
.include "${.CURDIR}/../Makefile.inc"
@@ -16,7 +16,7 @@ CFLAGS+= ${CEXTRAFLAGS} ${SAABI} -nostdinc -mno-abicalls -D_NO_ABICALLS \
-I${.OBJDIR}
# stand routines
-SRCS= alloc.c cons.c ctime.c exit.c getchar.c getfile.c gets.c globals.c \
+SRCS= alloc.c cons.c ctime.c exit.c getchar.c getfile.c getln.c globals.c \
memcmp.c memcpy.c memset.c printf.c putchar.c \
snprintf.c strchr.c strcmp.c strerror.c strncmp.c strncpy.c strtol.c
diff --git a/sys/arch/sgi/stand/libsa/Makefile b/sys/arch/sgi/stand/libsa/Makefile
index 3ad2bb84ee5..67608298e04 100644
--- a/sys/arch/sgi/stand/libsa/Makefile
+++ b/sys/arch/sgi/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.8 2013/01/01 18:49:33 miod Exp $
+# $OpenBSD: Makefile,v 1.9 2015/11/16 19:33:52 miod Exp $
LIB= sa
@@ -17,7 +17,7 @@ CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD ${STANDALONE}
CPPFLAGS+= ${LIBSA_CPPFLAGS}
# stand routines
-SRCS= alloc.c exit.c getfile.c gets.c globals.c \
+SRCS= alloc.c exit.c getfile.c getln.c globals.c \
memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c
# io routines
diff --git a/sys/arch/sparc/stand/boot/boot.c b/sys/arch/sparc/stand/boot/boot.c
index 14686a7f356..b08af2ff65c 100644
--- a/sys/arch/sparc/stand/boot/boot.c
+++ b/sys/arch/sparc/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.14 2015/05/19 20:42:11 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.15 2015/11/16 19:33:52 miod Exp $ */
/* $NetBSD: boot.c,v 1.2 1997/09/14 19:27:21 pk Exp $ */
/*-
@@ -357,11 +357,11 @@ main(int argc, char *argv[])
for (;;) {
if (prom_boothow & RB_ASKNAME) {
printf("device[%s]: ", prom_bootdevice);
- gets(dbuf);
+ getln(dbuf, sizeof dbuf);
if (dbuf[0])
prom_bootdevice = dbuf;
printf("boot: ");
- gets(fbuf);
+ getln(fbuf, sizeof fbuf);
if (fbuf[0])
file = fbuf;
}
diff --git a/sys/arch/sparc/stand/libsa/Makefile b/sys/arch/sparc/stand/libsa/Makefile
index b2c0b01f3a0..ed3bb5350c4 100644
--- a/sys/arch/sparc/stand/libsa/Makefile
+++ b/sys/arch/sparc/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.9 2014/11/19 20:01:36 miod Exp $
+# $OpenBSD: Makefile,v 1.10 2015/11/16 19:33:52 miod Exp $
LIB= sa
@@ -10,7 +10,7 @@ CFLAGS= -fno-pie -O2 -D_STANDALONE -D__INTERNAL_LIBSA_CREAD \
-I${.CURDIR}/../../../../lib/libsa
# stand routines
-SRCS= alloc.c exit.c getfile.c gets.c globals.c \
+SRCS= alloc.c exit.c getfile.c getln.c globals.c \
memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c
# io routines
diff --git a/sys/arch/sparc64/stand/libsa/Makefile b/sys/arch/sparc64/stand/libsa/Makefile
index 08a8735610b..a3e6d4126a1 100644
--- a/sys/arch/sparc64/stand/libsa/Makefile
+++ b/sys/arch/sparc64/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.10 2014/11/19 20:01:36 miod Exp $
+# $OpenBSD: Makefile,v 1.11 2015/11/16 19:33:52 miod Exp $
LIB= sa
@@ -16,7 +16,7 @@ CFLAGS= ${CEXTRAFLAGS} ${AFLAGS} -O2 -D__INTERNAL_LIBSA_CREAD -nostdinc \
CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD
# stand routines
-SRCS= alloc.c exit.c getfile.c gets.c globals.c \
+SRCS= alloc.c exit.c getfile.c getln.c globals.c \
memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c
# io routines
diff --git a/sys/arch/sparc64/stand/ofwboot/boot.c b/sys/arch/sparc64/stand/ofwboot/boot.c
index 053c9c8c744..198dab9deff 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.23 2014/12/11 10:52:07 stsp Exp $ */
+/* $OpenBSD: boot.c,v 1.24 2015/11/16 19:33:52 miod 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.
@@ -380,11 +380,11 @@ main()
/*
* case 1: boot net -a
- * -> gets loop
+ * -> getln loop
* case 2: boot net kernel [options]
- * -> boot kernel, gets loop
+ * -> boot kernel, getln loop
* case 3: boot net [options]
- * -> iterate boot list, gets loop
+ * -> iterate boot list, getln loop
*/
bootlp = kernels;
@@ -415,7 +415,7 @@ main()
}
if (!bootlp) {
printf("Boot: ");
- gets(bootline);
+ getln(bootline, sizeof bootline);
if (parseargs(bootline, &boothowto) == -1)
continue;
if (!*bootline) {
diff --git a/sys/arch/vax/stand/boot/boot.c b/sys/arch/vax/stand/boot/boot.c
index 8e99ec0c46f..ebd0823f829 100644
--- a/sys/arch/vax/stand/boot/boot.c
+++ b/sys/arch/vax/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.25 2014/02/19 22:13:53 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.26 2015/11/16 19:33:52 miod Exp $ */
/* $NetBSD: boot.c,v 1.18 2002/05/31 15:58:26 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -154,7 +154,7 @@ Xmain(void)
char *c, *d;
printf("> ");
- gets(line);
+ getln(line, sizeof line);
c = line;
while (*c == ' ')