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

icesprog: avoid crashes due to unsupported options #16

Merged
merged 1 commit into from
Nov 22, 2020

Conversation

umarcor
Copy link
Contributor

@umarcor umarcor commented Nov 22, 2020

Adding {NULL, 0, NULL, 0}, as the last long option avoids crashes when non-supported long options are provided.

Without this patch:

# ./icesprog.exe --version
Segmentation fault

With this patch:

# ./icesprog.exe --version
icesprog.exe: unknown option -- version
usage: icesprog.exe [OPTION] [FILE]    
             -w | --write                   write spi-flash
             -r | --read                    read  spi-flash
             -e | --erase                   erase spi-flash
             -p | --probe                   probe spi-flash
             -o | --offset                  spi-flash offset
             -l | --len                     len of write/read
             -h | --help                    display help info

             -- version 1.0 --

Copy link
Owner

@wuxx wuxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, Thanks for the patch! 👍

@wuxx wuxx merged commit c0c636b into wuxx:master Nov 22, 2020
@umarcor umarcor deleted the fix/icesprog branch November 22, 2020 10:18
@fatalfeel fatalfeel mentioned this pull request Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants