don't accept numbers as probe identifiers in trigger string
Only the probe name, as supplied by the device driver, is accepted.
This commit is contained in:
parent
33df15f144
commit
17ff11240e
23
strutil.c
23
strutil.c
|
@ -214,24 +214,19 @@ SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi,
|
||||||
|
|
||||||
tokens = g_strsplit(triggerstring, ",", max_probes);
|
tokens = g_strsplit(triggerstring, ",", max_probes);
|
||||||
for (i = 0; tokens[i]; i++) {
|
for (i = 0; tokens[i]; i++) {
|
||||||
if (tokens[i][0] < '0' || tokens[i][0] > '9') {
|
probenum = -1;
|
||||||
/* Named probe */
|
for (l = sdi->probes; l; l = l->next) {
|
||||||
probenum = 0;
|
probe = (struct sr_probe *)l->data;
|
||||||
for (l = sdi->probes; l; l = l->next) {
|
if (probe->enabled
|
||||||
probe = (struct sr_probe *)l->data;
|
&& !strncmp(probe->name, tokens[i],
|
||||||
if (probe->enabled
|
strlen(probe->name))) {
|
||||||
&& !strncmp(probe->name, tokens[i],
|
probenum = probe->index;
|
||||||
strlen(probe->name))) {
|
break;
|
||||||
probenum = probe->index;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
probenum = strtol(tokens[i], NULL, 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (probenum < 0 || probenum >= max_probes) {
|
if (probenum < 0 || probenum >= max_probes) {
|
||||||
sr_err("strutil: Invalid probe (%d).", probenum);
|
sr_err("strutil: Invalid probe.");
|
||||||
error = TRUE;
|
error = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue