Warning C6385
Invalid data: accessing buffer-name, the readable size is size1 bytes, but size2 bytes may be read: Lines: x, y
Remarks
The readable extent of the buffer might be smaller than the index used to read from it. Attempts to read data outside the valid range leads to buffer overrun.
Code analysis name: READ_OVERRUN
Example
The following code generates this warning:
void f(unsigned int i)
{
char a[20];
char j;
if (i <= 20) // C6385
{
j = a[i];
}
}
To correct this warning, use the following code:
void f(unsigned int i)
{
char a[20];
char j;
if (i < 20) // Okay
{
j = a[i];
}
}
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for