Skip to content

sdr type sub-command doesn't work when user specifiying hex value directly. #322

Open
accelas opened this issue Nov 9, 2021 · 0 comments · May be fixed by #359
Open

sdr type sub-command doesn't work when user specifiying hex value directly. #322

accelas opened this issue Nov 9, 2021 · 0 comments · May be fixed by #359

Comments

@accelas
Copy link

accelas commented Nov 9, 2021

if (!strcmp(type, "0x")) {

the code tries to compare a user specified hex value against "0x". eg, if user specify "0x80", the code tries to do strcmp("0x80", "0x"), and expect it to return 0. However, it seems strcmp() will return 0, if and only if two strings are exactly same. For this particular usage, I suggest to change the code to strncmp(type, "0x", 2); to force it to only compare first two characters.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant