Correct and/or improve detection of bogus row/column values

passed in via ioctls.
This commit is contained in:
oster 1999-08-14 02:41:36 +00:00
parent 582a6def8b
commit 4a058e82c5

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.25 1999/08/13 03:27:46 oster Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.26 1999/08/14 02:41:36 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@ -888,14 +888,11 @@ raidioctl(dev, cmd, data, flag, p)
}
row = component_label->row;
printf("Row: %d\n",row);
if (row > raidPtrs[unit]->numRow) {
row = 0; /* XXX */
}
column = component_label->column;
printf("Column: %d\n",column);
if (column > raidPtrs[unit]->numCol) {
column = 0; /* XXX */
if ((row < 0) || (row >= raidPtrs[unit]->numRow) ||
(column < 0) || (column >= raidPtrs[unit]->numCol)) {
return(EINVAL);
}
raidread_component_label(
@ -932,8 +929,8 @@ raidioctl(dev, cmd, data, flag, p)
row = component_label->row;
column = component_label->column;
if ((row < 0) || (row > raidPtrs[unit]->numRow) ||
(column < 0) || (column > raidPtrs[unit]->numCol)) {
if ((row < 0) || (row >= raidPtrs[unit]->numRow) ||
(column < 0) || (column >= raidPtrs[unit]->numCol)) {
return(EINVAL);
}
@ -1029,8 +1026,8 @@ raidioctl(dev, cmd, data, flag, p)
row = component.row;
column = component.column;
printf("Rebuild: %d %d\n",row, column);
if ((row < 0) || (row > raidPtrs[unit]->numRow) ||
(column < 0) || (column > raidPtrs[unit]->numCol)) {
if ((row < 0) || (row >= raidPtrs[unit]->numRow) ||
(column < 0) || (column >= raidPtrs[unit]->numCol)) {
return(EINVAL);
}
printf("Attempting a rebuild in place\n");