| 1234567891011121314151617 |
- #include <stdio.h>
- #include <string.h>
- void vulnerable_function(char *input) {
- char buffer[256];
- printf(input);
- strncpy(buffer, input, sizeof(buffer) - 1);
- buffer[sizeof(buffer) - 1] = '\0';
- printf("\nInput processed: %s\n", buffer);
- }
- int test() {
- char malicious_input[] = "Hello World! %x %x %x %x\n";
- vulnerable_function(malicious_input);
- return 0;
- }
|