projects
/
occt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2b442de
)
0022378: Small patch to fix buffer vulnerability of Draw
author
SZY
<>
Fri, 18 Nov 2011 09:58:53 +0000
(09:58 +0000)
committer
bugmaster
<bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:31:09 +0000
(19:31 +0400)
src/Draw/Draw_Window.cxx
patch
|
blob
|
blame
|
history
diff --git
a/src/Draw/Draw_Window.cxx
b/src/Draw/Draw_Window.cxx
index
587ef5f
..
2370d1c
100755
(executable)
--- a/
src/Draw/Draw_Window.cxx
+++ b/
src/Draw/Draw_Window.cxx
@@
-1945,8
+1945,9
@@
static Tk_Window mainWindow;
//* threads sinchronization *//
DWORD dwMainThreadId;
console_semaphore_value volatile console_semaphore = WAIT_CONSOLE_COMMAND;
//* threads sinchronization *//
DWORD dwMainThreadId;
console_semaphore_value volatile console_semaphore = WAIT_CONSOLE_COMMAND;
-char console_command[1000];
-
+//char console_command[1000];
+#define COMMAND_SIZE 1000 /* Console Command size */
+char console_command[COMMAND_SIZE];
bool volatile isTkLoopStarted = false;
/*--------------------------------------------------------*\
bool volatile isTkLoopStarted = false;
/*--------------------------------------------------------*\
@@
-2025,7
+2026,8
@@
static DWORD WINAPI readStdinThreadFunc(VOID)
while (1) {
while (console_semaphore != WAIT_CONSOLE_COMMAND)
Sleep(100);
while (1) {
while (console_semaphore != WAIT_CONSOLE_COMMAND)
Sleep(100);
- if (gets(console_command))
+ //if (gets(console_command))
+ if (fgets(console_command,COMMAND_SIZE,stdin))
{
console_semaphore = HAS_CONSOLE_COMMAND;
}
{
console_semaphore = HAS_CONSOLE_COMMAND;
}