1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-07 18:30:55 +03:00

OCC22360 Writing out of allocated memory in the method OSD_FontMgr::InitFontDataBase

This commit is contained in:
MSV 2011-04-28 15:16:31 +00:00 committed by bugmaster
parent 8e3006e453
commit 5b181c6297

View File

@ -118,7 +118,7 @@ void OSD_FontMgr::InitFontDataBase() {
Standard_Size req_size; Standard_Size req_size;
req_size = strlen( getenv("windir") ); req_size = strlen( getenv("windir") );
windir_var = new Standard_Character[req_size]; windir_var = new Standard_Character[req_size + 1];
strcpy( windir_var, getenv("windir") ); strcpy( windir_var, getenv("windir") );
@ -238,16 +238,11 @@ void OSD_FontMgr::InitFontDataBase() {
Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString; Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString;
Display * disp = XOpenDisplay("localhost:0.0"); Display * disp = XOpenDisplay("localhost:0.0");
if (!disp) if ( !disp )
{
// let the X server find the available connection
disp = XOpenDisplay(":0.0");
if (!disp)
{ {
cout << "Display is NULL!" << endl; cout << "Display is NULL!" << endl;
return ; return ;
} }
}
Standard_Integer npaths = 0; Standard_Integer npaths = 0;