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
07b6a624
Commit
07b6a624
authored
Aug 16, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lstrcpyn[AW] count should be considered unsigned.
parent
456ffd62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
string.c
memory/string.c
+26
-5
No files found.
memory/string.c
View file @
07b6a624
...
...
@@ -183,12 +183,18 @@ SEGPTR WINAPI lstrcpyn16( SEGPTR dst, LPCSTR src, INT16 n )
* lstrcpynA (KERNEL32.@)
*
* Note: this function differs from the UNIX strncpy, it _always_ writes
* a terminating \0
* a terminating \0.
*
* Note: n is an INT but Windows treats it as unsigned, and will happily
* copy a gazillion chars if n is negative.
*/
LPSTR
WINAPI
lstrcpynA
(
LPSTR
dst
,
LPCSTR
src
,
INT
n
)
{
LPSTR
p
=
dst
;
UINT
count
=
n
;
TRACE
(
"(%p, %s, %i)
\n
"
,
dst
,
debugstr_a
(
src
),
n
);
/* In real windows the whole function is protected by an exception handler
* that returns ERROR_INVALID_PARAMETER on faulty parameters
* We currently just check for NULL.
...
...
@@ -197,21 +203,32 @@ LPSTR WINAPI lstrcpynA( LPSTR dst, LPCSTR src, INT n )
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
while
((
n
--
>
1
)
&&
*
src
)
*
p
++
=
*
src
++
;
if
(
n
>=
0
)
*
p
=
0
;
while
((
count
>
1
)
&&
*
src
)
{
count
--
;
*
p
++
=
*
src
++
;
}
if
(
count
)
*
p
=
0
;
return
dst
;
}
/***********************************************************************
* lstrcpynW (KERNEL32.@)
*
* Note: this function differs from the UNIX strncpy, it _always_ writes
* a terminating \0
*
* Note: n is an INT but Windows treats it as unsigned, and will happily
* copy a gazillion chars if n is negative.
*/
LPWSTR
WINAPI
lstrcpynW
(
LPWSTR
dst
,
LPCWSTR
src
,
INT
n
)
{
LPWSTR
p
=
dst
;
UINT
count
=
n
;
TRACE
(
"(%p, %s, %i)
\n
"
,
dst
,
debugstr_w
(
src
),
n
);
/* In real windows the whole function is protected by an exception handler
* that returns ERROR_INVALID_PARAMETER on faulty parameters
* We currently just check for NULL.
...
...
@@ -220,8 +237,12 @@ LPWSTR WINAPI lstrcpynW( LPWSTR dst, LPCWSTR src, INT n )
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
while
((
n
--
>
1
)
&&
*
src
)
*
p
++
=
*
src
++
;
if
(
n
>=
0
)
*
p
=
0
;
while
((
count
>
1
)
&&
*
src
)
{
count
--
;
*
p
++
=
*
src
++
;
}
if
(
count
)
*
p
=
0
;
return
dst
;
}
...
...
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