Fix a newly introduced lifetime violation

TOSTRAND() creates a pointer with temporary lifetime which we must not
access outside of the expression where it is created.

Incidentally, this is what I had before a polish with good intentions,
which, as we all know, are not enough.

Noticed by Geoff, thank you

Ref ISO/IEC 9899:2018 §6.2.4 (8)
Ref 0c96fc65
parent c4710e95
......@@ -439,7 +439,6 @@ vsl_line(VRT_CTX, char *str)
{
VCL_INT id;
VCL_ENUM side;
VCL_STRANDS s;
const char *tag, *delim = " \t\r\n";
char *save;
......@@ -469,11 +468,9 @@ vsl_line(VRT_CTX, char *str)
str = strtok_r(NULL, "\r\n", &save);
if (str == NULL)
s = vrt_null_strands;
vmod_vsl(ctx, id, tag, side, vrt_null_strands);
else
s = TOSTRAND(str);
vmod_vsl(ctx, id, tag, side, s);
vmod_vsl(ctx, id, tag, side, TOSTRAND(str));
}
VCL_VOID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment