This commit is contained in:
2026-01-06 15:54:17 +01:00
parent c823836626
commit 4c3e281ef5
4 changed files with 62 additions and 0 deletions

27
4/level6/level6.c Normal file
View File

@@ -0,0 +1,27 @@
// gcc -o level6 -no-pie -fstack-protector level6.c
#include <stdio.h>
#include <unistd.h>
void win(void) {
char *argv[2];
argv[0] = "/bin/sh";
argv[1] = NULL;
execve(argv[0], argv, NULL);
}
int main(int argc, char **argv) {
// Disable output buffering. Not part of the challenge.
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stdin, NULL, _IONBF, 0);
char buffer[64];
while (1) {
puts("What do you want to talk about?");
read(0, buffer, 128);
if (buffer[0] == '\0' || buffer[0] == '\n') break;
printf("I can't talk about %s.\n", buffer);
}
puts("Bye.");
return 0;
}