Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int test(int a)
- {
- return a;
- }
- movl %edi, -20(%rbp) ; save function parameter onto stack (unrelated to canary)
- movq __stack_chk_guard(%rip), %rax ; load magic value into EAX register
- movq %rax, -8(%rbp) ; save EAX register onto stack (place the canary)
- movl -20(%rbp), %eax ; load function parameter into EAX register for return (unrelated to canary)
- movq -8(%rbp), %rcx ; load canary value into RCX register
- movq __stack_chk_guard(%rip), %rdx ; load magic value into RDX register
- cmpq %rdx, %rcx ; compare canary value to expected value
- je .L3 ; if they are the same, jump to label .L3 (continue)
- call __stack_chk_fail ; otherwise (stack corruption detected), call the handler
- .L3:
- leave
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement