Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobcode
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-blobcode
Commits
e39f531c
Commit
e39f531c
authored
Apr 07, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: in decode_n for base64, count down inlen before breaking when
we hit the null terminator for a string in a STRING_LIST
parent
1bd658d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
base64.c
src/base64.c
+10
-10
No files found.
src/base64.c
View file @
e39f531c
...
...
@@ -60,12 +60,16 @@ decode(char *restrict *restrict dest, char *restrict const buf,
{
char
*
d
;
if
(
n
<=
1
)
if
(
n
<=
1
)
{
errno
=
EINVAL
;
return
-
1
;
}
d
=
*
dest
;
for
(
int
i
=
0
;
i
<
n
-
1
;
i
++
)
{
if
(
d
==
buf
+
buflen
)
if
(
d
==
buf
+
buflen
)
{
errno
=
ENOMEM
;
return
-
1
;
}
*
d
++
=
(
u
>>
16
)
&
0xff
;
u
<<=
8
;
}
...
...
@@ -154,19 +158,17 @@ base64_decode(const enum encoding dec, char *restrict const buf,
continue
;
}
u
|=
(
unsigned
)
b
;
if
(
!*
s
)
break
;
if
(
inlen
!=
-
1
)
{
--
inlen
;
if
(
inlen
==
0
)
break
;
}
if
(
!*
s
)
break
;
}
if
(
n
==
4
)
{
if
(
decode
(
&
dest
,
buf
,
buflen
,
u
,
n
-
term
)
<
0
)
{
errno
=
ENOMEM
;
if
(
decode
(
&
dest
,
buf
,
buflen
,
u
,
n
-
term
)
<
0
)
return
-
1
;
}
n
=
0
;
}
}
...
...
@@ -176,10 +178,8 @@ base64_decode(const enum encoding dec, char *restrict const buf,
if
(
n
)
{
if
(
!
alpha
->
padding
)
u
<<=
6
*
(
4
-
n
);
if
(
decode
(
&
dest
,
buf
,
buflen
,
u
,
n
-
term
)
<
0
)
{
errno
=
ENOMEM
;
if
(
decode
(
&
dest
,
buf
,
buflen
,
u
,
n
-
term
)
<
0
)
return
-
1
;
}
}
return
dest
-
buf
;
...
...
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