Skip to content

Commit 70a33f3

Browse files
joejoe
authored andcommitted
use proper string conversion for RAID level using create method
using atoi returns 0 for any non-integer passed to it. this could configure RAID 0 in the kernel which was not intended for when one mistakenly passes a non-integer string. uses an internal conversion function that produces proper error message. pullup 10 and 11
1 parent 643afcd commit 70a33f3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sbin/raidctl/raidctl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: raidctl.c,v 1.86 2024/11/05 20:07:41 rillig Exp $ */
1+
/* $NetBSD: raidctl.c,v 1.87 2026/02/14 17:02:19 joe Exp $ */
22

33
/*-
44
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
3939
#include <sys/cdefs.h>
4040

4141
#ifndef lint
42-
__RCSID("$NetBSD: raidctl.c,v 1.86 2024/11/05 20:07:41 rillig Exp $");
42+
__RCSID("$NetBSD: raidctl.c,v 1.87 2026/02/14 17:02:19 joe Exp $");
4343
#endif
4444

4545

@@ -1248,7 +1248,7 @@ rf_simple_create(int fd, int argc, char *argv[])
12481248
if (strcmp(argv[0],"mirror")==0) {
12491249
level = 1;
12501250
} else
1251-
level = atoi(argv[0]);
1251+
level = xstrtouint(argv[0]);
12521252

12531253
if (level != 0 && level != 1 && level !=5)
12541254
usage();

0 commit comments

Comments
 (0)