Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simon Wilson
KWSys
Commits
dad68c33
Commit
dad68c33
authored
9 years ago
by
James Johnston
Committed by
Brad King
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Encoding: Fix undefined behavior if out of memory.
Change-Id: Id632329f3593da977ce52de42ad39af4e6fb01dd
parent
4db8e69f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
EncodingC.c
+10
-4
10 additions, 4 deletions
EncodingC.c
with
10 additions
and
4 deletions
EncodingC.c
+
10
−
4
View file @
dad68c33
...
...
@@ -45,8 +45,11 @@ wchar_t* kwsysEncoding_DupToWide(const char* str)
if
(
length
>
0
)
{
ret
=
(
wchar_t
*
)
malloc
((
length
)
*
sizeof
(
wchar_t
));
ret
[
0
]
=
0
;
kwsysEncoding_mbstowcs
(
ret
,
str
,
length
);
if
(
ret
)
{
ret
[
0
]
=
0
;
kwsysEncoding_mbstowcs
(
ret
,
str
,
length
);
}
}
return
ret
;
}
...
...
@@ -72,8 +75,11 @@ char* kwsysEncoding_DupToNarrow(const wchar_t* str)
if
(
length
>
0
)
{
ret
=
(
char
*
)
malloc
(
length
);
ret
[
0
]
=
0
;
kwsysEncoding_wcstombs
(
ret
,
str
,
length
);
if
(
ret
)
{
ret
[
0
]
=
0
;
kwsysEncoding_wcstombs
(
ret
,
str
,
length
);
}
}
return
ret
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment