RE: Buffer overflow examples 07-29-2014, 10:22 AM
#16
(07-29-2014, 05:53 AM)0xDEAD10CC Wrote: Why did you leave out the return declaration for main()? And where is fclose()? (// ignore not properly closing file handles)
Here's an obvious example in a minimalistic form:
Code:#include <stdio.h> #include <string.h> int main(void) { char encrypted[5] = "$A4R"; // derived eventually from some complex series of algorithms (?) char buffer[5]; char user_intput[] = "?????haha"; printf("Original: %s\n", encrypted); strcpy(buffer, user_intput); // Fail printf("Overwritten: %s\n", encrypted); }
Probably typo, donnu the thread is old.




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)