Partial lab6

This commit is contained in:
2025-12-20 15:44:03 +00:00
parent ef11ce0307
commit 82b7b8c565
15 changed files with 304 additions and 0 deletions

27
pa/lab6/functions.c Normal file
View File

@@ -0,0 +1,27 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "general.h"
void win() {
printf("Congratulations, you win!!! You successfully changed the code flow\n");
printf("Flag: %s\n", getflag());
}
int main() {
init();
int (*fp)();
char buffer[32];
fp = 0;
printf("You win this game if you are able to call the function win. Can you do it?\n");
gets(buffer);
if(fp) {
printf("Calling function pointer... jumping to %p\n", fp);
fp();
}
}