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

Fix filename detection in curl #385

Closed
terriko opened this issue Feb 22, 2020 · 3 comments
Closed

Fix filename detection in curl #385

terriko opened this issue Feb 22, 2020 · 3 comments
Labels
good first issue Good for newcomers

Comments

@terriko
Copy link
Contributor

terriko commented Feb 22, 2020

Like with bug #383 , curl has broken filename detection and it's probably what inspired the other two:

if filename[::-1].startswith(("curl")[::-1]):

This won't work in practice. The example below is with bluetooth but the same idea applies:

>>> filename = "bluetoothctl.so"
>>> filename[::-1]
'os.ltchtooteulb'
>>> filename[::-1].startswith(("bluetoothctl")[::-1])
False
>>>

Removing [::-1] in both places in that line should do the trick:

>>> filename.startswith(("bluetoothctl"))
True

If you're feeling ambitious, it would be nice to have a test for this.

@terriko terriko added the good first issue Good for newcomers label Feb 22, 2020
@bigbird555
Copy link
Contributor

bigbird555 commented Feb 22, 2020

I just thought the code below would resolve the bug but what do you think of it ?
if filename.find(("curl")) >= 0:

@bigbird555
Copy link
Contributor

bigbird555 commented Feb 22, 2020

When you apply the above change, you will get the result below.
https://github.com/intel/cve-bin-tool/runs/462069846
I can not clearly understand what the message means and I do not know how to improve it more....
Is there any advice here ?

@Shrawan907
Copy link

if filename[::-1].startswith(("curl")[::-1]):
in place of it we can use
if filename.endswith(("curl")):

terriko added a commit that referenced this issue Feb 25, 2020
terriko added a commit that referenced this issue Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants