Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
2fd1c81b
Unverified
Commit
2fd1c81b
authored
Mar 10, 2020
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmod_blob flexelinting
parent
f42141f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
base64.c
lib/libvmod_blob/base64.c
+2
-1
hex.c
lib/libvmod_blob/hex.c
+1
-1
vmod_blob.c
lib/libvmod_blob/vmod_blob.c
+11
-3
No files found.
lib/libvmod_blob/base64.c
View file @
2fd1c81b
...
...
@@ -253,7 +253,8 @@ base64_encode(const enum encoding enc, const enum case_e kase,
}
}
}
assert
(
p
>=
buf
&&
p
-
buf
<=
buflen
);
assert
(
p
>=
buf
);
assert
(
p
<=
buf
+
buflen
);
return
(
p
-
buf
);
}
...
...
lib/libvmod_blob/hex.c
View file @
2fd1c81b
...
...
@@ -135,7 +135,7 @@ hex_decode(const enum encoding dec, blob_dest_t buf,
if
(
len
==
0
)
return
(
0
);
if
(
n
!=
-
1
&&
len
>
n
)
if
(
n
>
0
&&
len
>
n
)
len
=
n
;
if
(((
len
+
1
)
>>
1
)
>
buflen
)
{
...
...
lib/libvmod_blob/vmod_blob.c
View file @
2fd1c81b
...
...
@@ -422,6 +422,7 @@ vmod_transcode(VRT_CTX, VCL_ENUM decs, VCL_ENUM encs, VCL_ENUM case_s,
struct
vrt_blob
b
;
VCL_STRING
r
;
size_t
l
;
ssize_t
len
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
ws
,
WS_MAGIC
);
...
...
@@ -447,14 +448,16 @@ vmod_transcode(VRT_CTX, VCL_ENUM decs, VCL_ENUM encs, VCL_ENUM case_s,
if
(
length
<=
0
)
length
=
-
1
;
errno
=
0
;
b
.
len
=
func
[
dec
].
decode
(
dec
,
buf
,
l
,
length
,
strings
);
b
.
blob
=
buf
;
len
=
func
[
dec
].
decode
(
dec
,
buf
,
l
,
length
,
strings
);
if
(
b
.
len
==
-
1
)
{
if
(
len
<
0
)
{
err_decode
(
ctx
,
strings
->
p
[
0
]);
return
(
NULL
);
}
b
.
len
=
len
;
b
.
blob
=
buf
;
/*
* If the encoding and decoding are the same, and the decoding was
* legal, just return the concatenated string.
...
...
@@ -529,6 +532,11 @@ vmod_sub(VRT_CTX, VCL_BLOB b, VCL_BYTES n, VCL_BYTES off)
assert
(
b
->
len
>
0
);
if
(
off
<
0
||
n
<
0
)
{
ERR
(
ctx
,
"size and offset cannot be negative in blob.sub()"
);
return
(
NULL
);
}
if
(
off
+
n
>
b
->
len
)
{
VERR
(
ctx
,
"size %jd from offset %jd requires more bytes than "
"blob length %zd in blob.sub()"
,
...
...
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