diff options
| author | oster <oster@NetBSD.org> | 1999-08-14 02:41:36 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 1999-08-14 02:41:36 +0000 |
| commit | 4a058e82c533b4d5cb3c9b8e8ecc0224646c9680 (patch) | |
| tree | db69013ed10860d40b0eb82a2202ac338797139f /sys/dev/raidframe | |
| parent | 582a6def8bae70400d35ea50e4e82d09d8235467 (diff) | |
Correct and/or improve detection of bogus row/column values
passed in via ioctls.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index e59a715713c..be5f7731bc7 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -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"); |
