Freigeben über


C6385

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

warning C6385: invalid data: accessing <buffer name>, the readable size is <size1> bytes, but <size2> bytes may be read: Lines: x, y

This warning indicates that the readable extent of the specified buffer might be smaller than the index used to read from it. Attempts to read data outside the valid range leads to buffer overrun.

Example

The following code generates this warning:

void f(int i)  
{  
   char a[20];  
   char j;  
   if (i <= 20)  
   {  
      j = a[i];  
   }  
}  

To correct this warning, use the following code:

void f(int i)  
{  
   char a[20];  
   char j;  
   if (i < 20)  
   {  
      j = a[i];  
   }  
}