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
395a65bd
Commit
395a65bd
authored
Aug 05, 2017
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix strcpy implementation so it works on overlapping buffers.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
967fb744
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
32 additions
and
11 deletions
+32
-11
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr110.spec
dlls/msvcr110/msvcr110.spec
+1
-1
msvcr120.spec
dlls/msvcr120/msvcr120.spec
+1
-1
msvcr70.spec
dlls/msvcr70/msvcr70.spec
+1
-1
msvcr71.spec
dlls/msvcr71/msvcr71.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
string.c
dlls/msvcrt/string.c
+10
-0
string.c
dlls/msvcrt/tests/string.c
+13
-2
ucrtbase.spec
dlls/ucrtbase/ucrtbase.spec
+1
-1
No files found.
dlls/msvcr100/msvcr100.spec
View file @
395a65bd
...
...
@@ -1800,7 +1800,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcpy_s(ptr long str) MSVCRT_strcpy_s
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
...
...
dlls/msvcr110/msvcr110.spec
View file @
395a65bd
...
...
@@ -2158,7 +2158,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcpy_s(ptr long str) MSVCRT_strcpy_s
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
...
...
dlls/msvcr120/msvcr120.spec
View file @
395a65bd
...
...
@@ -2368,7 +2368,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcpy_s(ptr long str) MSVCRT_strcpy_s
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
...
...
dlls/msvcr70/msvcr70.spec
View file @
395a65bd
...
...
@@ -813,7 +813,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
@ cdecl strftime(ptr long str ptr) MSVCRT_strftime
...
...
dlls/msvcr71/msvcr71.spec
View file @
395a65bd
...
...
@@ -809,7 +809,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
@ cdecl strftime(ptr long str ptr) MSVCRT_strftime
...
...
dlls/msvcr80/msvcr80.spec
View file @
395a65bd
...
...
@@ -1480,7 +1480,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcpy_s(ptr long str) MSVCRT_strcpy_s
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
...
...
dlls/msvcr90/msvcr90.spec
View file @
395a65bd
...
...
@@ -1453,7 +1453,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcpy_s(ptr long str) MSVCRT_strcpy_s
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
...
...
dlls/msvcrt/msvcrt.spec
View file @
395a65bd
...
...
@@ -1421,7 +1421,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcpy_s(ptr long str) MSVCRT_strcpy_s
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
...
...
dlls/msvcrt/string.c
View file @
395a65bd
...
...
@@ -697,6 +697,16 @@ char* __cdecl MSVCRT_strncpy(char *dst, const char *src, MSVCRT_size_t len)
}
/*********************************************************************
* strcpy (MSVCRT.@)
*/
char
*
CDECL
MSVCRT_strcpy
(
char
*
dst
,
const
char
*
src
)
{
char
*
ret
=
dst
;
while
((
*
dst
++
=
*
src
++
));
return
ret
;
}
/*********************************************************************
* strcpy_s (MSVCRT.@)
*/
int
CDECL
MSVCRT_strcpy_s
(
char
*
dst
,
MSVCRT_size_t
elem
,
const
char
*
src
)
...
...
dlls/msvcrt/tests/string.c
View file @
395a65bd
...
...
@@ -56,6 +56,7 @@ static void* (__cdecl *pmemcpy)(void *, const void *, size_t n);
static
int
(
__cdecl
*
p_memcpy_s
)(
void
*
,
size_t
,
const
void
*
,
size_t
);
static
int
(
__cdecl
*
p_memmove_s
)(
void
*
,
size_t
,
const
void
*
,
size_t
);
static
int
*
(
__cdecl
*
pmemcmp
)(
void
*
,
const
void
*
,
size_t
n
);
static
int
(
__cdecl
*
p_strcpy
)(
char
*
dst
,
const
char
*
src
);
static
int
(
__cdecl
*
pstrcpy_s
)(
char
*
dst
,
size_t
len
,
const
char
*
src
);
static
int
(
__cdecl
*
pstrcat_s
)(
char
*
dst
,
size_t
len
,
const
char
*
src
);
static
int
(
__cdecl
*
p_mbscat_s
)(
unsigned
char
*
dst
,
size_t
size
,
const
unsigned
char
*
src
);
...
...
@@ -493,8 +494,8 @@ static void test_strdup(void)
static
void
test_strcpy_s
(
void
)
{
char
dest
[
8
];
const
char
*
small
=
"small"
;
const
char
*
big
=
"atoolongstringforthislittledestination"
;
const
char
small
[]
=
"small"
;
const
char
big
[]
=
"atoolongstringforthislittledestination"
;
int
ret
;
if
(
!
pstrcpy_s
)
...
...
@@ -543,6 +544,15 @@ static void test_strcpy_s(void)
ret
=
pstrcpy_s
(
NULL
,
sizeof
(
dest
),
small
);
ok
(
ret
==
EINVAL
,
"Copying a big string a NULL dest returned %d, expected EINVAL
\n
"
,
ret
);
/* strcpy overlapping buffers test */
memset
(
dest
,
'X'
,
sizeof
(
dest
));
memcpy
(
dest
+
1
,
small
,
sizeof
(
small
));
p_strcpy
(
dest
,
dest
+
1
);
ok
(
dest
[
0
]
==
's'
&&
dest
[
1
]
==
'm'
&&
dest
[
2
]
==
'a'
&&
dest
[
3
]
==
'l'
&&
dest
[
4
]
==
'l'
&&
dest
[
5
]
==
'\0'
&&
dest
[
6
]
==
'\0'
&&
dest
[
7
]
==
'X'
,
"Unexpected return data from strcpy: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x
\n
"
,
dest
[
0
],
dest
[
1
],
dest
[
2
],
dest
[
3
],
dest
[
4
],
dest
[
5
],
dest
[
6
],
dest
[
7
]);
}
#define NUMELMS(array) (sizeof(array)/sizeof((array)[0]))
...
...
@@ -3199,6 +3209,7 @@ START_TEST(string)
SET
(
pmemcmp
,
"memcmp"
);
SET
(
p_mbctype
,
"_mbctype"
);
SET
(
p__mb_cur_max
,
"__mb_cur_max"
);
SET
(
p_strcpy
,
"strcpy"
);
pstrcpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"strcpy_s"
);
pstrcat_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"strcat_s"
);
p_mbscat_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbscat_s"
);
...
...
dlls/ucrtbase/ucrtbase.spec
View file @
395a65bd
...
...
@@ -2499,7 +2499,7 @@
@ cdecl strchr(str long) MSVCRT_strchr
@ cdecl strcmp(str str) MSVCRT_strcmp
@ cdecl strcoll(str str) MSVCRT_strcoll
@ cdecl strcpy(ptr str)
ntdll.
strcpy
@ cdecl strcpy(ptr str)
MSVCRT_
strcpy
@ cdecl strcpy_s(ptr long str) MSVCRT_strcpy_s
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
...
...
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