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
2c061dba
Commit
2c061dba
authored
Sep 26, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Check for NULL output buffer in FormatMessage{A, W}.
parent
ca77cb10
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
format_msg.c
dlls/kernel32/format_msg.c
+12
-0
format_msg.c
dlls/kernel32/tests/format_msg.c
+18
-0
No files found.
dlls/kernel32/format_msg.c
View file @
2c061dba
...
...
@@ -154,6 +154,12 @@ DWORD WINAPI FormatMessageA(
&&
((
dwFlags
&
FORMAT_MESSAGE_FROM_SYSTEM
)
||
(
dwFlags
&
FORMAT_MESSAGE_FROM_HMODULE
)))
return
0
;
if
(
!
lpBuffer
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
0
;
}
if
(
width
&&
width
!=
FORMAT_MESSAGE_MAX_WIDTH_MASK
)
FIXME
(
"line wrapping (%u) not supported.
\n
"
,
width
);
from
=
NULL
;
...
...
@@ -368,6 +374,12 @@ DWORD WINAPI FormatMessageW(
&&
((
dwFlags
&
FORMAT_MESSAGE_FROM_SYSTEM
)
||
(
dwFlags
&
FORMAT_MESSAGE_FROM_HMODULE
)))
return
0
;
if
(
!
lpBuffer
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
if
(
width
&&
width
!=
FORMAT_MESSAGE_MAX_WIDTH_MASK
)
FIXME
(
"line wrapping not supported.
\n
"
);
from
=
NULL
;
...
...
dlls/kernel32/tests/format_msg.c
View file @
2c061dba
...
...
@@ -220,7 +220,25 @@ static void test_message_from_string(void)
ok
(
r
==
2
,
"failed: r=%d
\n
"
,
r
);
}
static
void
test_message_null_buffer
(
void
)
{
DWORD
ret
,
error
;
SetLastError
(
0xdeadbeef
);
ret
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_ALLOCATE_BUFFER
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"FormatMessageA returned %u
\n
"
,
ret
);
ok
(
error
==
ERROR_NOT_ENOUGH_MEMORY
,
"last error %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
FormatMessageW
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_ALLOCATE_BUFFER
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"FormatMessageW returned %u
\n
"
,
ret
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"last error %u
\n
"
,
error
);
}
START_TEST
(
format_msg
)
{
test_message_from_string
();
test_message_null_buffer
();
}
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