Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

st-util cannot parse -V and -F options and --freq option results in a segmentation fault #1428

Closed
sansyse opened this issue Sep 30, 2024 · 0 comments · Fixed by #1429
Closed

Comments

@sansyse
Copy link

sansyse commented Sep 30, 2024

-V and -F options are not recognized on the command line of st-util program. When using --freq option a segmentation fault is the result.

examples:
$st-util -p 3333 -V --connect-under-reset --multi --semihosting -v99
st-util: invalid option -- 'V'

$st-util -p 3333 --connect-under-reset --multi --semihosting -v99 -F 2M
st-util: invalid option -- 'F'
non-option ARGV-elements: 2M

$st-util -p 3333 --connect-under-reset --multi --semihosting -v99 --freq 500k
st-util: Speicherzugriffsfehler

The reason is a bug in a getopt_long() parameters in main() function and missing NULL pointer security in arg_parse_freq() helper function.

See PR #1429

sansyse pushed a commit to sansyse/stlink that referenced this issue Sep 30, 2024
    - Added '-V' and '-F' option to the getopt_long() optstring.
    - Marked -F/--freq option with required argument.
    - Added NULL pointer checks to helper function arg_parse_freq().
@Nightwalker-87 Nightwalker-87 changed the title [all]: st-util cannot parse -V and -F options and --freq option results in a segmentation fault. st-util cannot parse -V and -F options and --freq option results in a segmentation fault Oct 3, 2024
@Nightwalker-87 Nightwalker-87 added this to the v1.8.1 milestone Oct 3, 2024
@Nightwalker-87 Nightwalker-87 moved this to In review in Release v1.8.1 Oct 3, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in Release v1.8.1 Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants