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
9d6513e6
Commit
9d6513e6
authored
Jan 18, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix base64_decode() for a concatenated STRING_LIST
parent
35bf67b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
base64.c
src/base64.c
+7
-4
base64.vtc
src/tests/base64.vtc
+22
-0
No files found.
src/base64.c
View file @
9d6513e6
...
...
@@ -192,7 +192,7 @@ base64_decode(const enum encoding dec, char *restrict const buf,
const
char
*
s
;
char
*
dest
=
buf
;
unsigned
u
=
0
,
term
=
0
;
int
n
;
int
n
=
0
;
AN
(
buf
);
...
...
@@ -204,13 +204,14 @@ base64_decode(const enum encoding dec, char *restrict const buf,
return
-
1
;
}
while
(
*
s
)
{
for
(
n
=
0
;
n
<
4
;
n
++
)
{
while
(
n
<
4
)
{
char
b
=
alpha
->
i64
[(
unsigned
)
*
s
++
];
u
<<=
6
;
if
(
b
==
ILLEGAL
)
{
errno
=
EINVAL
;
return
-
1
;
}
n
++
;
if
(
b
==
PAD
)
{
term
++
;
continue
;
...
...
@@ -219,14 +220,16 @@ base64_decode(const enum encoding dec, char *restrict const buf,
if
(
!*
s
)
break
;
}
if
(
n
==
4
)
if
(
n
==
4
)
{
if
(
decode
(
&
dest
,
buf
,
maxlen
,
u
,
n
-
term
)
<
0
)
{
errno
=
ENOMEM
;
return
-
1
;
}
n
=
0
;
}
}
}
if
(
n
!=
4
)
if
(
n
)
if
(
decode
(
&
dest
,
buf
,
maxlen
,
u
,
n
-
term
)
<
0
)
{
errno
=
ENOMEM
;
return
-
1
;
...
...
src/tests/base64.vtc
View file @
9d6513e6
...
...
@@ -49,6 +49,25 @@ varnish v1 -vcl+backend {
=
convert
.
encode
(
BASE64
,
convert
.
decode
(
BASE64
,
"L0hlbGxvIHdvcmxkLw=="
));
set
resp
.
http
.
l
=
"L"
;
set
resp
.
http
.
dec2pieces
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
BASE64
,
resp
.
http
.
l
+
"0hlbGxvIHdvcmxkLw=="
));
set
resp
.
http
.
pad
=
"=="
;
set
resp
.
http
.
dec3pieces
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
BASE64
,
resp
.
http
.
l
+
"0hlbGxvIHdvcmxkLw"
+
resp
.
http
.
pad
));
set
resp
.
http
.
mid1
=
"GxvI"
;
set
resp
.
http
.
mid2
=
"dvcmx"
;
set
resp
.
http
.
dec7pieces
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
BASE64
,
resp
.
http
.
l
+
"0hlb"
+
resp
.
http
.
mid1
+
"H"
+
resp
.
http
.
mid2
+
"kLw"
+
resp
.
http
.
pad
));
}
}
-
start
...
...
@@ -64,6 +83,9 @@ client c1 {
expect
resp
.
http
.
dec
==
"/Hello world/"
expect
resp
.
http
.
dec2
==
"The quick brown fox jumps over the lazy dog"
expect
resp
.
http
.
decenc
==
"L0hlbGxvIHdvcmxkLw=="
expect
resp
.
http
.
dec2pieces
==
"/Hello world/"
expect
resp
.
http
.
dec3pieces
==
"/Hello world/"
expect
resp
.
http
.
dec7pieces
==
"/Hello world/"
}
client
c1
-
run
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