Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1b3c04d2
Commit
1b3c04d2
authored
Dec 26, 2001
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Dec 26, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check the return value of *snprintf for C99 style overflow reporting.
parent
096524c5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
7 deletions
+14
-7
format_msg.c
dlls/kernel/format_msg.c
+4
-2
lstr.c
dlls/user/lstr.c
+4
-2
wineconsole.c
programs/wineconsole/wineconsole.c
+1
-1
console.c
win32/console.c
+5
-2
No files found.
dlls/kernel/format_msg.c
View file @
1b3c04d2
...
...
@@ -265,6 +265,7 @@ DWORD WINAPI FormatMessageA(
strcpy
(
fmtstr
,
"%s"
);
}
if
(
args
)
{
int
ret
;
int
sz
;
LPSTR
b
;
...
...
@@ -282,8 +283,9 @@ DWORD WINAPI FormatMessageA(
b
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sz
=
100
);
/* CMF - This makes a BIG assumption about va_list */
TRACE
(
"A BIG assumption
\n
"
);
while
(
vsnprintf
(
b
,
sz
,
fmtstr
,
(
va_list
)
argliststart
)
<
0
)
{
b
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
b
,
sz
+=
100
);
while
((
ret
=
vsnprintf
(
b
,
sz
,
fmtstr
,
(
va_list
)
argliststart
)
<
0
)
||
(
ret
>=
sz
))
{
sz
=
(
ret
==
-
1
?
sz
+
100
:
ret
+
1
);
b
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
b
,
sz
);
}
}
for
(
x
=
b
;
*
x
;
x
++
)
ADD_TO_T
(
*
x
);
...
...
dlls/user/lstr.c
View file @
1b3c04d2
...
...
@@ -683,14 +683,16 @@ DWORD WINAPI FormatMessage16(
strcpy
(
fmtstr
,
"%s"
);
}
if
(
args
)
{
int
ret
;
int
sz
;
LPSTR
b
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sz
=
100
);
argliststart
=
args
+
insertnr
-
1
;
/* CMF - This makes a BIG assumption about va_list */
while
(
vsnprintf
(
b
,
sz
,
fmtstr
,
(
va_list
)
argliststart
)
<
0
)
{
b
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
b
,
sz
+=
100
);
while
((
ret
=
vsnprintf
(
b
,
sz
,
fmtstr
,
(
va_list
)
argliststart
)
<
0
)
||
(
ret
>=
sz
))
{
sz
=
(
ret
==
-
1
?
sz
+
100
:
ret
+
1
);
b
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
b
,
sz
);
}
for
(
x
=
b
;
*
x
;
x
++
)
ADD_TO_T
(
*
x
);
}
else
{
...
...
programs/wineconsole/wineconsole.c
View file @
1b3c04d2
...
...
@@ -22,7 +22,7 @@ void XTracer(int level, const char* format, ...)
len
=
vsnprintf
(
buf
,
sizeof
(
buf
),
format
,
valist
);
va_end
(
valist
);
if
(
len
<=
-
1
)
if
(
(
len
<=
-
1
)
||
(
len
>=
sizeof
(
buf
)))
{
len
=
sizeof
(
buf
)
-
1
;
buf
[
len
]
=
0
;
...
...
win32/console.c
View file @
1b3c04d2
...
...
@@ -62,6 +62,7 @@ BOOL WINAPI FreeConsole(VOID)
static
BOOL
start_console_renderer
(
void
)
{
char
buffer
[
256
];
int
ret
;
STARTUPINFOA
si
;
PROCESS_INFORMATION
pi
;
HANDLE
hEvent
=
0
;
...
...
@@ -85,14 +86,16 @@ static BOOL start_console_renderer(void)
/* first try environment variable */
if
((
p
=
getenv
(
"WINECONSOLE"
))
!=
NULL
)
{
if
(
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s -- --use-event=%d"
,
p
,
hEvent
)
>
0
&&
ret
=
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s -- --use-event=%d"
,
p
,
hEvent
);
if
((
ret
>
-
1
)
&&
(
ret
<
sizeof
(
buffer
))
&&
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
DETACHED_PROCESS
,
NULL
,
NULL
,
&
si
,
&
pi
))
goto
succeed
;
ERR
(
"Couldn't launch Wine console from WINECONSOLE env var... trying default access
\n
"
);
}
/* then the regular installation dir */
if
(
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s -- --use-event=%d"
,
BINDIR
"/wineconsole"
,
hEvent
)
>
0
&&
ret
=
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s -- --use-event=%d"
,
BINDIR
"/wineconsole"
,
hEvent
);
if
((
ret
>
-
1
)
&&
(
ret
<
sizeof
(
buffer
))
&&
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
DETACHED_PROCESS
,
NULL
,
NULL
,
&
si
,
&
pi
))
goto
succeed
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment