Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
savoirfairelinux
jami-daemon
Commits
fbafa847
Commit
fbafa847
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
base64: prevent crash in case of empty input
Change-Id: I2bfbde86083829d553a1f79e1c91aed4b2bedd6f
parent
321f83d8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/base64.cpp
+6
-0
6 additions, 0 deletions
src/base64.cpp
with
6 additions
and
0 deletions
src/base64.cpp
+
6
−
0
View file @
fbafa847
...
...
@@ -33,6 +33,9 @@ encode(const std::vector<uint8_t>::const_iterator begin,
const
std
::
vector
<
uint8_t
>::
const_iterator
end
)
{
int
input_length
=
std
::
distance
(
begin
,
end
);
if
(
input_length
==
0
)
return
{};
int
output_length
=
PJ_BASE256_TO_BASE64_LEN
(
input_length
);
std
::
string
out
;
out
.
resize
(
output_length
);
...
...
@@ -54,6 +57,9 @@ encode(const std::vector<uint8_t>& dat)
std
::
vector
<
uint8_t
>
decode
(
const
std
::
string
&
str
)
{
if
(
str
.
empty
())
return
{};
int
output_length
=
PJ_BASE64_TO_BASE256_LEN
(
str
.
length
());
const
pj_str_t
input
(
sip_utils
::
CONST_PJ_STR
(
str
));
...
...
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