mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-08-11 09:33:52 +08:00
Coding - Dangerous use of 'cin' (#681)
- Replaced hardcoded buffer sizes with `constexpr size_t aBufferSize` constants - Added `width()` calls to input streams before reading to prevent buffer overflows - Applied consistent buffer size management across multiple input operations
This commit is contained in:
@@ -3038,8 +3038,10 @@ Standard_Integer IFSelect_Functions::GiveEntityNumber(const Handle(IFSelect_Work
|
||||
Standard_Integer num = 0;
|
||||
if (!name || name[0] == '\0')
|
||||
{
|
||||
char ligne[80];
|
||||
constexpr size_t aBufferSize = 80;
|
||||
char ligne[aBufferSize];
|
||||
ligne[0] = '\0';
|
||||
std::cin.width(aBufferSize);
|
||||
std::cin >> ligne;
|
||||
// std::cin.clear(); std::cin.getline (ligne,79);
|
||||
if (ligne[0] == '\0')
|
||||
|
||||
Reference in New Issue
Block a user