Browse Source

Bugfix: antminer: Avoid strstr(NULL, ...) when device has no [available] product string

Luke Dashjr 10 years ago
parent
commit
2e4e61e8ee
1 changed files with 2 additions and 0 deletions
  1. 2 0
      driver-antminer.c

+ 2 - 0
driver-antminer.c

@@ -49,6 +49,8 @@ static const char *bm1382_chips[] = {
 
 
 static bool antminer_chip_has_bm1382_freq_register(const char * const prodstr)
 static bool antminer_chip_has_bm1382_freq_register(const char * const prodstr)
 {
 {
+	if (!prodstr)
+		return false;
 	for (const char **chipname = bm1382_chips; *chipname; ++chipname) {
 	for (const char **chipname = bm1382_chips; *chipname; ++chipname) {
 		if (strstr(prodstr, *chipname)) {
 		if (strstr(prodstr, *chipname)) {
 			return true;
 			return true;