Browse Source

Avoid null deref in command line arg processing.

Reported by lfm.
Jeff Garzik 15 years ago
parent
commit
276dcdbcec
1 changed files with 2 additions and 1 deletions
  1. 2 1
      cpu-miner.c

+ 2 - 1
cpu-miner.c

@@ -328,7 +328,8 @@ static void parse_arg (int key, char *arg)
 	switch(key) {
 	case 'a':
 		for (i = 0; i < ARRAY_SIZE(algo_names); i++) {
-			if (!strcmp(arg, algo_names[i])) {
+			if (algo_names[i] &&
+			    !strcmp(arg, algo_names[i])) {
 				opt_algo = i;
 				break;
 			}