From 5b181c62979974bc0d8cd6f0a607c2f231d3f9fa Mon Sep 17 00:00:00 2001 From: MSV <> Date: Thu, 28 Apr 2011 15:16:31 +0000 Subject: [PATCH] OCC22360 Writing out of allocated memory in the method OSD_FontMgr::InitFontDataBase --- src/OSD/OSD_FontMgr.cxx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/OSD/OSD_FontMgr.cxx b/src/OSD/OSD_FontMgr.cxx index 8756666052..adec9c2c5d 100755 --- a/src/OSD/OSD_FontMgr.cxx +++ b/src/OSD/OSD_FontMgr.cxx @@ -118,7 +118,7 @@ void OSD_FontMgr::InitFontDataBase() { Standard_Size req_size; 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") ); @@ -238,15 +238,10 @@ void OSD_FontMgr::InitFontDataBase() { Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString; 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; - return ; - } + cout << "Display is NULL!" << endl; + return ; } Standard_Integer npaths = 0; -- 2.39.5