mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Rework line_pulse_duration_option_parse()
Introduce proper sscanf() checks.
This commit is contained in:
parent
9744fcafcf
commit
76a7a56e85
1 changed files with 28 additions and 26 deletions
|
|
@ -176,11 +176,8 @@ void line_pulse_duration_option_parse(const char *arg)
|
||||||
char keyname[11];
|
char keyname[11];
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
|
|
||||||
if (sscanf(token, "%10[^=]=%d", keyname, &value) != 2)
|
if (sscanf(token, "%10[^=]=%d", keyname, &value) == 2)
|
||||||
{
|
{
|
||||||
token_found = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(keyname, "DTR"))
|
if (!strcmp(keyname, "DTR"))
|
||||||
{
|
{
|
||||||
option.dtr_pulse_duration = value;
|
option.dtr_pulse_duration = value;
|
||||||
|
|
@ -211,6 +208,11 @@ void line_pulse_duration_option_parse(const char *arg)
|
||||||
token_found = false;
|
token_found = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
token_found = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue