aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2010-12-05 23:18:18 -0500
committerJeff Garzik <jgarzik@redhat.com>2010-12-05 23:18:18 -0500
commit276dcdbcec044b44835eacd16982badce3ad4d87 (patch)
tree5fa7caa6b5b58007294a562e2d939ecac267621d
parent18d3ab876c5c2b77c56b436bcf7f7507ec451455 (diff)
Avoid null deref in command line arg processing.
Reported by lfm.
-rw-r--r--cpu-miner.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cpu-miner.c b/cpu-miner.c
index a47d77a..ab7ea1a 100644
--- a/cpu-miner.c
+++ b/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;
}