2
\$\begingroup\$

In honour of CrowdStrike's exception at 0x9c, what's the shortest way (character-wise) to cause a segfault by dereferencing address 0x9c?

The best I can come up with is:

int main(){*(int*)156=0;}

Rules:

  • It must be valid C++ (so no removing the return type int of main)
  • It must crash the program
\$\endgroup\$
2
  • 8
    \$\begingroup\$ Please note that asking for malicious code is forbidden (there may be a more relevant post on meta -- didn't find it). That said, I would not say that a seg fault really counts as malicious code. It's just a bit borderline. \$\endgroup\$
    – Arnauld
    Commented Jul 20 at 9:31
  • 1
    \$\begingroup\$ Shortening it would be difficult, but for only one extra character you can disguise it ;) int main(){39[(int*)0]=0;}: Try it online See assembly \$\endgroup\$
    – DPD-
    Commented Jul 20 at 16:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.