Commit 1ef41943 authored by Cory Quammen's avatar Cory Quammen

Fix -Wrestrict warning

'char* strncpy(char*, const char*, size_t)' accessing 76 bytes at offsets 0 and 4
 overlaps 72 bytes at offset 4 [-Wrestrict]

The warning is because strncpy was being used on overlapping buffers.
parent 59e088b7
......@@ -4041,10 +4041,16 @@ int vtkEnSightGoldBinaryReader::ReadLine(char result[80])
if (this->Fortran)
{
for (int i = 0; i < 76 && result[i] != '\0'; ++i)
// strncpy cannot be used for overlapping buffers
int i = 0;
for ( ; i < 76 && result[i+4] != '\0'; ++i)
{
result[i] = result[i+4];
}
for ( ; i < 76; ++i)
{
result[i] = '\0';
}
result[76] = 0;
// better read an extra 8 bytes to prevent error next time
char dummy[8];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment