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
0630b480
Commit
0630b480
authored
Aug 12, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy the argument name to malloc'ed storage.
parent
26d26d30
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
mgt.h
bin/varnishd/mgt/mgt.h
+1
-1
mgt_util.c
bin/varnishd/mgt/mgt_util.c
+12
-1
mgt_stevedore.c
bin/varnishd/storage/mgt_stevedore.c
+2
-2
No files found.
bin/varnishd/mgt/mgt.h
View file @
0630b480
...
...
@@ -180,7 +180,7 @@ void mgt_DumpRstVsl(void);
struct
vsb
*
mgt_BuildVident
(
void
);
void
MGT_Complain
(
const
char
*
,
const
char
*
,
...)
__v_printflike
(
2
,
3
);
const
void
*
MGT_Pick
(
const
struct
choice
*
,
const
char
*
,
const
char
*
);
char
**
MGT_NamedArg
(
const
char
*
arg
,
const
char
**
name
,
const
char
*
what
);
char
**
MGT_NamedArg
(
const
char
*
,
const
char
**
,
const
char
*
);
/* stevedore_mgt.c */
...
...
bin/varnishd/mgt/mgt_util.c
View file @
0630b480
...
...
@@ -194,7 +194,9 @@ char **
MGT_NamedArg
(
const
char
*
spec
,
const
char
**
name
,
const
char
*
what
)
{
const
char
*
p
,
*
q
;
char
*
r
;
char
**
av
;
int
l
;
ASSERT_MGT
();
p
=
strchr
(
spec
,
'='
);
...
...
@@ -214,6 +216,15 @@ MGT_NamedArg(const char *spec, const char **name, const char *what)
if
(
av
[
0
]
!=
NULL
)
ARGV_ERR
(
"%s
\n
"
,
av
[
0
]);
*
name
=
p
;
if
(
p
==
NULL
)
{
*
name
=
NULL
;
}
else
{
l
=
p
-
spec
;
r
=
malloc
(
1L
+
l
);
AN
(
r
);
memcpy
(
r
,
spec
,
l
);
r
[
l
]
=
'\0'
;
*
name
=
r
;
}
return
(
av
);
}
bin/varnishd/storage/mgt_stevedore.c
View file @
0630b480
...
...
@@ -178,10 +178,10 @@ STV_Config(const char *spec)
bprintf
(
stv
->
ident
,
"s%u"
,
seq
++
);
else
{
/* XXX: no need for truncation once VSM ident becomes dynamic */
l
=
name
-
spec
;
l
=
strlen
(
name
)
;
if
(
l
>
sizeof
stv
->
ident
-
1
)
l
=
sizeof
stv
->
ident
-
1
;
bprintf
(
stv
->
ident
,
"%.*s"
,
l
,
spec
);
bprintf
(
stv
->
ident
,
"%.*s"
,
l
,
name
);
}
stv_check_ident
(
spec
,
stv
->
ident
);
...
...
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