From 276dcdbcec044b44835eacd16982badce3ad4d87 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sun, 5 Dec 2010 23:18:18 -0500 Subject: [PATCH] Avoid null deref in command line arg processing. Reported by lfm. --- cpu-miner.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpu-miner.c b/cpu-miner.c index a47d77a5..ab7ea1ac 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; }