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
c8d44130
Commit
c8d44130
authored
Sep 08, 2006
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Sep 08, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netapi32: Avoid NULL access in NetApiBufferAllocate, with test.
parent
4388bdac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
apibuf.c
dlls/netapi32/apibuf.c
+2
-0
apibuf.c
dlls/netapi32/tests/apibuf.c
+15
-0
No files found.
dlls/netapi32/apibuf.c
View file @
c8d44130
...
...
@@ -36,6 +36,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
NET_API_STATUS
WINAPI
NetApiBufferAllocate
(
DWORD
ByteCount
,
LPVOID
*
Buffer
)
{
TRACE
(
"(%ld, %p)
\n
"
,
ByteCount
,
Buffer
);
if
(
Buffer
==
NULL
)
return
ERROR_INVALID_PARAMETER
;
*
Buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ByteCount
);
if
(
*
Buffer
)
return
NERR_Success
;
...
...
dlls/netapi32/tests/apibuf.c
View file @
c8d44130
...
...
@@ -39,6 +39,7 @@ static void run_apibuf_tests(void)
{
VOID
*
p
;
DWORD
dwSize
;
NET_API_STATUS
res
;
if
(
!
pNetApiBufferAllocate
)
return
;
...
...
@@ -76,6 +77,20 @@ static void run_apibuf_tests(void)
ok
(
pNetApiBufferSize
(
p
,
&
dwSize
)
==
NERR_Success
,
"Got size
\n
"
);
ok
((
dwSize
>=
0
)
&&
(
dwSize
<
0xFFFFFFFF
),
"The size of the 0-length buffer
\n
"
);
ok
(
pNetApiBufferFree
(
p
)
==
NERR_Success
,
"Freed
\n
"
);
/* NULL-Pointer */
/* NT: ERROR_INVALID_PARAMETER, lasterror is untouched) */
SetLastError
(
0xdeadbeef
);
res
=
pNetApiBufferAllocate
(
0
,
(
LPVOID
*
)
NULL
);
ok
(
(
res
==
ERROR_INVALID_PARAMETER
)
&&
(
GetLastError
()
==
0xdeadbeef
),
"returned %ld with 0x%lx (expected ERROR_INVALID_PARAMETER with "
\
"0xdeadbeef)
\n
"
,
res
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
res
=
pNetApiBufferAllocate
(
1024
,
(
LPVOID
*
)
NULL
);
ok
(
(
res
==
ERROR_INVALID_PARAMETER
)
&&
(
GetLastError
()
==
0xdeadbeef
),
"returned %ld with 0x%lx (expected ERROR_INVALID_PARAMETER with "
\
"0xdeadbeef)
\n
"
,
res
,
GetLastError
());
}
START_TEST
(
apibuf
)
...
...
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