Skip to content

Commit a52fec8

Browse files
committed
code/C/format-string.c: Comment to point out the actual format string exploit
Signed-off-by: Marian Marinov <[email protected]>
1 parent 1efced4 commit a52fec8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

code/C/format-string.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
int main (int argc, char **argv) {
66
char buf[10] = { '\0' };
77
int x = 1;
8-
snprintf(buf, sizeof(buf), argv[1]);
8+
9+
// snprintf(buf, sizeof(buf), "%s", argv[1]); // here is a simple fix
10+
11+
snprintf(buf, sizeof(buf), argv[1]); // the actual exploit
912
buf[sizeof(buf)-1] = 0;
1013
printf("Buffer size is: (%d) \nData input: %s \n", strlen(buf), buf);
1114
printf("in hex: %#x\nMemory address for x: (%p) \n", x, &x);

0 commit comments

Comments
 (0)