[PATCH 2/3] Cochran: Fixed segfault when unknown model is opened.
John Van Ostrand
john at vanostrand.com
Sat Jan 23 14:36:47 PST 2016
Opening an unkown model would cause a segfault when a NULL pointer
was referenced.
---
src/cochran_commander.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cochran_commander.c b/src/cochran_commander.c
index 97e0531..74464e2 100644
--- a/src/cochran_commander.c
+++ b/src/cochran_commander.c
@@ -325,7 +325,7 @@ cochran_commander_device_open (dc_device_t **out, dc_context_t *context,
layout = cochran_commander_get_layout(device->model_string);
// Check ID
- if ((layout->model & 0xFF0000) == COCHRAN_MODEL_UNKNOWN) {
+ if (!layout || (layout->model & 0xFF0000) == COCHRAN_MODEL_UNKNOWN) {
ERROR (context,
"Unknown Cochran model %02x %02x %02x %02x %02x %02x %02x %02x",
device->model_string[0], device->model_string[1],
--
2.4.3
More information about the devel
mailing list