Skip to content

fix(example): mistakes in fuzz_x8664_linux binary#1121

Merged
xwings merged 1 commit intoqilingframework:devfrom
chinggg:fix-example-fuzz-x8664
Mar 31, 2022
Merged

fix(example): mistakes in fuzz_x8664_linux binary#1121
xwings merged 1 commit intoqilingframework:devfrom
chinggg:fix-example-fuzz-x8664

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!

- Using the result of an assignment as a condition without parentheses
- Replace printf with puts
@chinggg chinggg force-pushed the fix-example-fuzz-x8664 branch from 23b9ed2 to 26fe48d Compare March 30, 2022 00:54
@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
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.

3 participants