Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


warning C6386: buffer overrun: accessing <buffer name>, the writable size is <size1> bytes, but <size2> bytes may be written: Lines: x, y

This warning indicates that the writable extent of the specified buffer might be smaller than the index used to write to it. This can cause buffer overrun.


The following code generates both this warning and C6201:

#define MAX 25

void f ( )
  char ar[MAX];
  //Code ...
  ar[MAX] = '\0';

To correct both warnings, use the following code:

#define MAX 25

void f ( )
   char a[MAX];
   // code...
   a[MAX - 1] = '\0';

See Also



Community Additions

© 2015 Microsoft