fluke-45: avoid NULL dereference in the probe routine

The Fluke 45 probe routine tries to detect whether the serial port is
"in echo mode" (which already is questionable before the IDN query).
In the absence of a response, the library segfaults. Fix it.
This commit is contained in:
Gerhard Sittig 2018-11-03 14:28:56 +01:00 committed by user
parent 88c03eae85
commit 712f7d5e40
1 changed files with 2 additions and 1 deletions

View File

@ -68,8 +68,9 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
sdi->conn = scpi;
/* Test for serial port ECHO enabled. */
response = NULL;
sr_scpi_get_string(scpi, "ECHO-TEST", &response);
if (strcmp(response, "ECHO-TEST") == 0) {
if (response && strcmp(response, "ECHO-TEST") == 0) {
sr_err("Serial port ECHO is ON. Please turn it OFF!");
return NULL;
}