PR 51200 gets in libsa considered harmful: use kgets

This commit is contained in:
dholland 2016-06-11 06:58:42 +00:00
parent f86cea3851
commit bf8938557c
4 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* $NetBSD: main.c,v 1.30 2016/01/04 14:10:15 phx Exp $
* $NetBSD: main.c,v 1.31 2016/06/11 07:01:25 dholland Exp $
*
*
* Copyright (c) 1996,1999 Ignatios Souvatzis
@ -164,7 +164,7 @@ again:
printf("\n");
printf("Boot: [%s] ", kernel_name);
gets(linebuf);
kgets(linebuf, sizeof(linebuf));
if (*linebuf == 'q')
return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.7 2016/05/31 04:13:26 dholland Exp $ */
/* $NetBSD: boot.c,v 1.8 2016/06/11 06:58:42 dholland Exp $ */
/*
* Copyright (c) 2009 NONAKA Kimihiro <nonaka@netbsd.org>
@ -416,7 +416,7 @@ bootmenu(void)
input[0] = '\0';
printf("> ");
gets(input);
kgets(input, sizeof(input));
/*
* Skip leading whitespace.

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootmenu.c,v 1.4 2014/08/10 07:40:50 isaki Exp $ */
/* $NetBSD: bootmenu.c,v 1.5 2016/06/11 06:58:42 dholland Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -99,7 +99,7 @@ doboottypemenu(void)
printf("\nOption: [%d]:",
bootcfg_info.def + 1);
gets(input);
kgets(input, sizeof(input));
choice = getchoicefrominput(input, bootcfg_info.def);
} else if (bootcfg_info.timeout == 0)
choice = bootcfg_info.def;

View File

@ -1,4 +1,4 @@
/* $NetBSD: getfile.c,v 1.9 2007/11/24 13:20:55 isaki Exp $ */
/* $NetBSD: getfile.c,v 1.10 2016/06/11 06:59:21 dholland Exp $ */
/*-
* Copyright (c) 1993
@ -42,7 +42,7 @@ getfile(char *prompt, int mode)
do {
printf("%s: ", prompt);
gets(buf);
kgets(buf, sizeof(buf));
if (buf[0] == CTRL('d') && buf[1] == 0)
return -1;
} while ((fd = open(buf, mode)) < 0);