Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(example): mistakes in fuzz_x8664_linux binary #1121

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

chinggg
Copy link
Contributor

@chinggg chinggg commented Mar 28, 2022

Checklist

Which kind of PR do you create?

  • This PR only contains minor fixes.
  • This PR contains major feature update.
  • This PR introduces a new function/api for Qiling Framework.

Coding convention?

  • The new code conforms to Qiling Framework naming convention.
  • The imports are arranged properly.
  • Essential comments are added.
  • The reference of the new code is pointed out.

Extra tests?

  • No extra tests are needed for this PR.
  • I have added enough tests for this PR.
  • Tests will be added after some discussion and review.

Changelog?

  • This PR doesn't need to update Changelog.
  • Changelog will be updated after some proper review.
  • Changelog has been updated in my PR.

Target branch?

  • The target branch is dev branch.

One last thing


IMO, fuzz.c intended to read from stdin to buf and copy it to buf2, then print buf2 as string.
But there are two mistakes which do not affect the fuzzing result, I think they are typos:

  • *buf = getc(stdin) == 'A' does not reads char, but the result of comparison
  • printf(buf2) does not print buf2 as string

So I fix fuzz.c then compile it with gcc -g on Ubuntu 20.04 + gcc9.3, and modify the according address of main and stack_chk in fuzz_x8664_linux.py, it works as before.

If you think the fix is correct, the arm_qnx example may need fix as well.

Copy link
Member

@elicn elicn left a comment

Choose a reason for hiding this comment

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

Good catch!

examples/fuzzing/linux_x8664/fuzz.c Outdated Show resolved Hide resolved
- Using the result of an assignment as a condition without parentheses
- Replace printf with puts
@xwings
Copy link
Member

xwings commented Mar 31, 2022

Hey, thanks and welcome to Qiling !

@xwings xwings merged commit 3c0dc0b into qilingframework:dev Mar 31, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants