> I want correct typing mistakes when booting from softraid crypto disks.
> Can we handle at least the backspace key, plz^Hease? :)
This calls for a libsa gets() replacement, which will honour bounds.
What about the plumbing diff below, so that softraid-capable bootblocks
can use the new getln() routine instead of rolling their own?
Index: arch/amd64/stand/pxeboot/Makefile
===
RCS file: /OpenBSD/src/sys/arch/amd64/stand/pxeboot/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- arch/amd64/stand/pxeboot/Makefile 2 Sep 2015 01:52:26 - 1.24
+++ arch/amd64/stand/pxeboot/Makefile 30 Oct 2015 16:27:31 -
@@ -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 \
Index: arch/aviion/stand/boot/boot.c
===
RCS file: /OpenBSD/src/sys/arch/aviion/stand/boot/boot.c,v
retrieving revision 1.5
diff -u -p -r1.5 boot.c
--- arch/aviion/stand/boot/boot.c 24 Feb 2014 20:15:37 - 1.5
+++ arch/aviion/stand/boot/boot.c 30 Oct 2015 16:27:31 -
@@ -109,7 +109,7 @@ boot(const char *args, uint bootdev, uin
for (;;) {
if (ask != 0) {
printf("boot: ");
- gets(line);
+ getln(line, sizeof line);
if (line[0] == '\0')
continue;
Index: arch/aviion/stand/libsa/Makefile
===
RCS file: /OpenBSD/src/sys/arch/aviion/stand/libsa/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- arch/aviion/stand/libsa/Makefile19 Nov 2014 20:01:35 - 1.6
+++ arch/aviion/stand/libsa/Makefile30 Oct 2015 16:27:31 -
@@ -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 \
Index: arch/hppa/stand/libsa/Makefile
===
RCS file: /OpenBSD/src/sys/arch/hppa/stand/libsa/Makefile,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile
--- arch/hppa/stand/libsa/Makefile 13 Jul 2014 09:26:08 - 1.19
+++ arch/hppa/stand/libsa/Makefile 30 Oct 2015 16:27:31 -
@@ -20,7 +20,7 @@ SRCS= machdep.c pdc.c itecons.c dev_hppa
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
Index: arch/hppa64/stand/libsa/Makefile
===
RCS file: /OpenBSD/src/sys/arch/hppa64/stand/libsa/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- arch/hppa64/stand/libsa/Makefile13 Jul 2014 09:26:08 - 1.5
+++ arch/hppa64/stand/libsa/Makefile30 Oct 2015 16:27:31 -
@@ -21,7 +21,7 @@ SRCS= machdep.c pdc.c itecons.c dev_hppa
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
Index: arch/loongson/stand/libsa/Makefile
===
RCS file: /OpenBSD/src/sys/arch/loongson/stand/libsa/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- arch/loongson/stand/libsa/Makefile 13 Jul 2014 09:26:08 - 1.6
+++ arch/loongson/stand/libsa/Makefile 30 Oct 2015 16:27:32 -
@@ -16,7 +16,7 @@ CFLAGS+= ${CEXTRAFLAGS} ${SAABI} -nostdi
-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