mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0027703: BinTools_ShapeSet stream read bug
Avoid out of array bounds read/write.
This commit is contained in:
parent
056072196c
commit
1aee6c8210
@ -395,8 +395,11 @@ void BinTools_ShapeSet::Read(Standard_IStream& IS)
|
|||||||
IS.getline(vers,100,'\n');
|
IS.getline(vers,100,'\n');
|
||||||
// BUC60769 PTV 18.10.2000: remove possible '\r' at the end of the line
|
// BUC60769 PTV 18.10.2000: remove possible '\r' at the end of the line
|
||||||
|
|
||||||
for (Standard_Size lv = (strlen(vers)- 1); lv > 1 && (vers[lv] == '\r' || vers[lv] == '\n') ;lv--)
|
Standard_Size lv = strlen(vers);
|
||||||
vers[lv] = '\0';
|
if (lv > 0) {
|
||||||
|
for (lv--; lv > 0 && (vers[lv] == '\r' || vers[lv] == '\n'); lv--)
|
||||||
|
vers[lv] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
} while ( ! IS.fail() && strcmp(vers,Version_1) && strcmp(vers,Version_2) &&
|
} while ( ! IS.fail() && strcmp(vers,Version_1) && strcmp(vers,Version_2) &&
|
||||||
strcmp(vers,Version_3));
|
strcmp(vers,Version_3));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user