diff mbox

keytable: fix segfault when RC driver's module_name is null

Message ID 1306575316-25536-1-git-send-email-cschieli@gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Cédric Schieli May 28, 2011, 9:35 a.m. UTC
Some dvb-usb drivers do not set a proper module_name in their rc.core struct
(e.g. the ttusb2 module and various dib0700 submodules as of 2.6.39).
Auto-load mode was segfaulting if trying to match those drivers with a * value.

Signed-off-by: Cédric Schieli <cschieli@gmail.com>
---
 utils/keytable/keytable.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index c406a18..13df13b 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -1427,9 +1427,9 @@  int main(int argc, char *argv[])
 		int rc;
 
 		for (cur = &cfg; cur->next; cur = cur->next) {
-			if (strcasecmp(cur->driver, rc_dev.drv_name) && strcasecmp(cur->driver, "*"))
+			if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name)) && strcasecmp(cur->driver, "*"))
 				continue;
-			if (strcasecmp(cur->table, rc_dev.keytable_name) && strcasecmp(cur->table, "*"))
+			if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name)) && strcasecmp(cur->table, "*"))
 				continue;
 			break;
 		}