-
January 14th, 2013, 01:31 PM
#1
Windows strcpy overflow question
Hello,
I have the following code:
char buf[5];
strcpy(buf, "12345678");
When I run this from the IDE in Release mode, it works fine, no crashes. However, when I change "12345678" to "123456789" then I get this compilation warning:
warning C4789: destination of memory copy is too small
And also it crashes when i run it.
Can anyone explain why this is inconsistent, or what I am misunderstand?
Regards,
EK
Last edited by ekhule; January 15th, 2013 at 10:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|