Why should you use strncpy instead of strcpy?

后端 未结 10 941

Edit: I\'ve added the source for the example.

I came across this example:

char source[MAX] = \"123456789\";
char source1[MAX] = \"12         


        
10条回答
  •  误落风尘
    2020-11-22 06:31

    the strncpy is a safer version of strcpy as a matter of fact you should never use strcpy because its potential buffer overflow vulnerability which makes you system vulnerable to all sort of attacks

提交回复
热议问题