mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-03-14 23:10:03 +01:00
[SPCA] Vulnerabilities
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void echo() {
|
||||
char buf[4]; // Limited size
|
||||
gets(buf); // Assumes size matches, does not check!
|
||||
puts(buf);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Type a string:"); // No size check enforced!
|
||||
echo();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
echo:
|
||||
subq $24, %rsp # Allocate stack space for buf
|
||||
movq %rsp, %rdi
|
||||
call gets
|
||||
movq %rsp, %rdi
|
||||
call puts
|
||||
addq $24, %rsp
|
||||
ret
|
||||
Reference in New Issue
Block a user