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
f906be9e
Commit
f906be9e
authored
Oct 15, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Don't validate parameters in _itoa function.
parent
26c751ea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
string.c
dlls/msvcrt/string.c
+18
-13
string.c
dlls/msvcrt/tests/string.c
+5
-0
No files found.
dlls/msvcrt/string.c
View file @
f906be9e
...
...
@@ -980,10 +980,7 @@ unsigned __int64 CDECL MSVCRT_strtoui64(const char *nptr, char **endptr, int bas
return
MSVCRT_strtoui64_l
(
nptr
,
endptr
,
base
,
NULL
);
}
/*********************************************************************
* _ltoa_s (MSVCRT.@)
*/
int
CDECL
_ltoa_s
(
MSVCRT_long
value
,
char
*
str
,
MSVCRT_size_t
size
,
int
radix
)
static
int
ltoa_helper
(
MSVCRT_long
value
,
char
*
str
,
MSVCRT_size_t
size
,
int
radix
)
{
MSVCRT_ulong
val
;
unsigned
int
digit
;
...
...
@@ -991,14 +988,6 @@ int CDECL _ltoa_s(MSVCRT_long value, char *str, MSVCRT_size_t size, int radix)
char
buffer
[
33
],
*
pos
;
size_t
len
;
if
(
!
MSVCRT_CHECK_PMT
(
str
!=
NULL
))
return
MSVCRT_EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
size
>
0
))
return
MSVCRT_EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
radix
>=
2
&&
radix
<=
36
))
{
str
[
0
]
=
'\0'
;
return
MSVCRT_EINVAL
;
}
if
(
value
<
0
&&
radix
==
10
)
{
is_negative
=
TRUE
;
...
...
@@ -1056,6 +1045,22 @@ int CDECL _ltoa_s(MSVCRT_long value, char *str, MSVCRT_size_t size, int radix)
}
/*********************************************************************
* _ltoa_s (MSVCRT.@)
*/
int
CDECL
_ltoa_s
(
MSVCRT_long
value
,
char
*
str
,
MSVCRT_size_t
size
,
int
radix
)
{
if
(
!
MSVCRT_CHECK_PMT
(
str
!=
NULL
))
return
MSVCRT_EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
size
>
0
))
return
MSVCRT_EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
radix
>=
2
&&
radix
<=
36
))
{
str
[
0
]
=
'\0'
;
return
MSVCRT_EINVAL
;
}
return
ltoa_helper
(
value
,
str
,
size
,
radix
);
}
/*********************************************************************
* _ltow_s (MSVCRT.@)
*/
int
CDECL
_ltow_s
(
MSVCRT_long
value
,
MSVCRT_wchar_t
*
str
,
MSVCRT_size_t
size
,
int
radix
)
...
...
@@ -1143,7 +1148,7 @@ int CDECL _itoa_s(int value, char *str, MSVCRT_size_t size, int radix)
*/
char
*
CDECL
_itoa
(
int
value
,
char
*
str
,
int
radix
)
{
return
_itoa_s
(
value
,
str
,
MSVCRT_SIZE_MAX
,
radix
)
?
NULL
:
str
;
return
ltoa_helper
(
value
,
str
,
MSVCRT_SIZE_MAX
,
radix
)
?
NULL
:
str
;
}
/*********************************************************************
...
...
dlls/msvcrt/tests/string.c
View file @
f906be9e
...
...
@@ -1882,6 +1882,11 @@ static void test__itoa_s(void)
ok
(
!
strcmp
(
buffer
,
"-12345678"
),
"Expected output buffer string to be
\"
-12345678
\"
, got
\"
%s
\"\n
"
,
buffer
);
itoa
(
100
,
buffer
,
100
);
ok
(
!
strcmp
(
buffer
,
"10"
),
"Expected output buffer string to be
\"
10
\"
, got
\"
%s
\"\n
"
,
buffer
);
if
(
p_set_invalid_parameter_handler
)
ok
(
p_set_invalid_parameter_handler
(
NULL
)
==
test_invalid_parameter_handler
,
"Cannot reset invalid parameter handler
\n
"
);
...
...
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