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
114062de
Commit
114062de
authored
Jun 17, 2021
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vav: VAV_ParseTxt() to work without a null terminator
I kept a variable called "s" to cut noise from the diff.
parent
e5d6a0f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
vav.h
include/vav.h
+1
-0
vav.c
lib/libvarnish/vav.c
+17
-7
No files found.
include/vav.h
View file @
114062de
...
...
@@ -31,6 +31,7 @@
*/
void
VAV_Free
(
char
**
argv
);
char
**
VAV_ParseTxt
(
const
char
*
b
,
const
char
*
e
,
int
*
argc
,
int
flag
);
char
**
VAV_Parse
(
const
char
*
s
,
int
*
argc
,
int
flag
);
char
*
VAV_BackSlashDecode
(
const
char
*
s
,
const
char
*
e
);
int
VAV_BackSlash
(
const
char
*
s
,
char
*
res
);
...
...
lib/libvarnish/vav.c
View file @
114062de
...
...
@@ -138,14 +138,17 @@ static char err_invalid_backslash[] = "Invalid backslash sequence";
static
char
err_missing_quote
[]
=
"Missing '
\"
'"
;
char
**
VAV_Parse
(
const
char
*
s
,
int
*
argc
,
int
flag
)
VAV_Parse
Txt
(
const
char
*
b
,
const
char
*
e
,
int
*
argc
,
int
flag
)
{
char
**
argv
;
const
char
*
p
;
const
char
*
s
,
*
p
;
int
nargv
,
largv
;
int
i
,
quote
;
assert
(
s
!=
NULL
);
AN
(
b
);
if
(
e
==
NULL
)
e
=
strchr
(
b
,
'\0'
);
s
=
b
;
nargv
=
1
;
largv
=
16
;
argv
=
calloc
(
largv
,
sizeof
*
argv
);
...
...
@@ -153,7 +156,7 @@ VAV_Parse(const char *s, int *argc, int flag)
return
(
NULL
);
for
(;;)
{
if
(
*
s
==
'\0'
)
if
(
s
>=
e
)
break
;
if
(
isspace
(
*
s
))
{
s
++
;
...
...
@@ -179,7 +182,7 @@ VAV_Parse(const char *s, int *argc, int flag)
continue
;
}
if
(
!
quote
)
{
if
(
*
s
==
'\0'
||
isspace
(
*
s
))
if
(
s
>=
e
||
isspace
(
*
s
))
break
;
if
((
flag
&
ARGV_COMMA
)
&&
*
s
==
','
)
break
;
...
...
@@ -188,7 +191,7 @@ VAV_Parse(const char *s, int *argc, int flag)
}
if
(
*
s
==
'"'
&&
!
(
flag
&
ARGV_NOESC
))
break
;
if
(
*
s
==
'\0'
)
{
if
(
s
>=
e
)
{
argv
[
0
]
=
err_missing_quote
;
return
(
argv
);
}
...
...
@@ -207,7 +210,7 @@ VAV_Parse(const char *s, int *argc, int flag)
}
else
{
argv
[
nargv
++
]
=
VAV_BackSlashDecode
(
p
,
s
);
}
if
(
*
s
!=
'\0'
)
if
(
s
<
e
)
s
++
;
}
argv
[
nargv
]
=
NULL
;
...
...
@@ -216,6 +219,13 @@ VAV_Parse(const char *s, int *argc, int flag)
return
(
argv
);
}
char
**
VAV_Parse
(
const
char
*
s
,
int
*
argc
,
int
flag
)
{
return
(
VAV_ParseTxt
(
s
,
NULL
,
argc
,
flag
));
}
void
VAV_Free
(
char
**
argv
)
{
...
...
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