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
04c42ac3
Commit
04c42ac3
authored
Jun 03, 2020
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make VJSN able to cope with \u0000
parent
08c46695
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
vjsn.h
include/vjsn.h
+2
-0
vjsn.c
lib/libvarnish/vjsn.c
+9
-6
No files found.
include/vjsn.h
View file @
04c42ac3
...
...
@@ -41,9 +41,11 @@ struct vjsn_val {
#define VJSN_VAL_MAGIC 0x08a06b80
const
char
*
type
;
const
char
*
name
;
const
char
*
name_e
;
VTAILQ_ENTRY
(
vjsn_val
)
list
;
VTAILQ_HEAD
(,
vjsn_val
)
children
;
char
*
value
;
char
*
value_e
;
};
struct
vjsn
{
...
...
lib/libvarnish/vjsn.c
View file @
04c42ac3
...
...
@@ -201,20 +201,21 @@ vjsn_unicode(struct vjsn *js, char **d)
}
static
char
*
vjsn_string
(
struct
vjsn
*
js
)
vjsn_string
(
struct
vjsn
*
js
,
char
**
e
)
{
char
*
p
,
*
b
;
AN
(
e
);
vjsn_skip_ws
(
js
);
VJSN_EXPECT
(
js
,
'"'
,
NULL
);
b
=
p
=
js
->
ptr
;
while
(
*
js
->
ptr
!=
'"'
)
{
if
(
*
js
->
ptr
==
'\0'
)
{
js
->
err
=
"Unterminate string"
;
js
->
err
=
"Unterminate
d
string"
;
return
(
NULL
);
}
if
((
unsigned
char
)(
*
js
->
ptr
)
<=
0x1f
)
{
js
->
err
=
"
u
nescaped control char in string"
;
js
->
err
=
"
U
nescaped control char in string"
;
return
(
NULL
);
}
if
(
*
js
->
ptr
!=
'\\'
)
{
...
...
@@ -242,6 +243,7 @@ vjsn_string(struct vjsn *js)
}
VJSN_EXPECT
(
js
,
'"'
,
NULL
);
*
p
=
'\0'
;
*
e
=
p
;
return
(
b
);
}
...
...
@@ -249,7 +251,7 @@ static struct vjsn_val *
vjsn_object
(
struct
vjsn
*
js
)
{
struct
vjsn_val
*
jsv
,
*
jsve
;
char
*
s
;
char
*
s
,
*
e
;
VJSN_EXPECT
(
js
,
'{'
,
NULL
);
...
...
@@ -259,7 +261,7 @@ vjsn_object(struct vjsn *js)
vjsn_skip_ws
(
js
);
if
(
*
js
->
ptr
!=
'}'
)
{
while
(
1
)
{
s
=
vjsn_string
(
js
);
s
=
vjsn_string
(
js
,
&
e
);
if
(
js
->
err
!=
NULL
)
return
(
jsv
);
vjsn_skip_ws
(
js
);
...
...
@@ -272,6 +274,7 @@ vjsn_object(struct vjsn *js)
}
CHECK_OBJ_NOTNULL
(
jsve
,
VJSN_VAL_MAGIC
);
jsve
->
name
=
s
;
jsve
->
name_e
=
e
;
VTAILQ_INSERT_TAIL
(
&
jsv
->
children
,
jsve
,
list
);
vjsn_skip_ws
(
js
);
if
(
*
js
->
ptr
==
'}'
)
...
...
@@ -372,7 +375,7 @@ vjsn_value(struct vjsn *js)
return
(
vjsn_array
(
js
));
if
(
*
js
->
ptr
==
'"'
)
{
jsv
=
vjsn_val_new
(
VJSN_STRING
);
jsv
->
value
=
vjsn_string
(
js
);
jsv
->
value
=
vjsn_string
(
js
,
&
jsv
->
value_e
);
if
(
js
->
err
!=
NULL
)
return
(
jsv
);
AN
(
jsv
->
value
);
...
...
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