Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22198

Can't getting a segmentation fault

$
0
0

I've seen from a Numberphile video (https://youtu.be/1S0aBV-Waeo) a way to run a buffer overflow, and I wanted to try it out.I have written a piece of code, which is identical to the one shown in the video except for the size of "buffer", but, if I give in input a string bigger than the size of "buffer", I am not getting a segmentation fault, as it was shown in the video; can someone explain why?

#include <stdio.h>#include <string.h>int main(int argc, char** argv){    char buffer[50];    strcpy(buffer, argv[1]);    return 0;}

Edit:By the way, as I've seen in the comments that this is a determinating thing, I am using th GCC compiler.


Viewing all articles
Browse latest Browse all 22198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>