Commit d5d56920dd8063babc287b0079d2d9eaaf61e20d

Con Kolivas 2011-07-26T22:41:42

Off by one limit in device selection.

diff --git a/main.c b/main.c
index 6044985..53a215d 100644
--- a/main.c
+++ b/main.c
@@ -1859,7 +1859,7 @@ retry:
 
 	if (!strncasecmp(&input, "e", 1)) {
 		selected = curses_int("Select GPU to enable");
-		if (selected < 0 || selected > nDevs) {
+		if (selected < 0 || selected >= nDevs) {
 			wlogprint("Invalid selection\n");
 			goto retry;
 		}
@@ -1880,7 +1880,7 @@ retry:
 		}
 	} if (!strncasecmp(&input, "d", 1)) {
 		selected = curses_int("Select GPU to disable");
-		if (selected < 0 || selected > nDevs) {
+		if (selected < 0 || selected >= nDevs) {
 			wlogprint("Invalid selection\n");
 			goto retry;
 		}
@@ -1891,7 +1891,7 @@ retry:
 		gpu_devices[selected] = false;
 	} else if (!strncasecmp(&input, "r", 1)) {
 		selected = curses_int("Select GPU to attempt to restart");
-		if (selected < 0 || selected > nDevs) {
+		if (selected < 0 || selected >= nDevs) {
 			wlogprint("Invalid selection\n");
 			goto retry;
 		}