Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
6ddfba14
Commit
6ddfba14
authored
May 10, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed buffer size handling in GetUserNameA (reported by Hannu
Valtonen).
parent
d19e2646
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
advapi.c
dlls/advapi32/advapi.c
+4
-2
No files found.
dlls/advapi32/advapi.c
View file @
6ddfba14
...
@@ -55,13 +55,14 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
...
@@ -55,13 +55,14 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
{
{
WCHAR
*
buffer
;
WCHAR
*
buffer
;
BOOL
ret
;
BOOL
ret
;
DWORD
sizeW
=
*
lpSize
*
2
;
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
lpSize
*
2
*
sizeof
(
WCHAR
)
)))
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeW
*
sizeof
(
WCHAR
)
)))
{
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
return
FALSE
;
}
}
ret
=
GetUserNameW
(
buffer
,
*
lpSize
*
2
);
ret
=
GetUserNameW
(
buffer
,
&
sizeW
);
if
(
ret
)
if
(
ret
)
{
{
if
(
!
(
*
lpSize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
buffer
,
-
1
,
lpszName
,
*
lpSize
,
NULL
,
NULL
)))
if
(
!
(
*
lpSize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
buffer
,
-
1
,
lpszName
,
*
lpSize
,
NULL
,
NULL
)))
...
@@ -71,6 +72,7 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
...
@@ -71,6 +72,7 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
ret
=
FALSE
;
ret
=
FALSE
;
}
}
}
}
else
*
lpSize
=
sizeW
*
2
;
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
ret
;
return
ret
;
}
}
...
...
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