[master] 531745096 vtc_varnish: Use a longer buffer during launch
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue May 7 13:48:05 UTC 2024
commit 531745096505f1c4c98ddfbdaf1de459cd1fabf0
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Apr 29 23:00:05 2024 +0200
vtc_varnish: Use a longer buffer during launch
When TMPDIR is much longer than /tmp, it becomes easy to run out of
abuf. Since abuf and pbuf are initially used to hold an IP address
and a port number, it becomes explicit in their declaration. Likewise
the new lbuf may hold a file name and safely be reused for CLI auth
and other purposes.
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 59941b3db..bc42a6dde 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -386,7 +386,9 @@ varnish_launch(struct varnish *v)
{
struct vsb *vsb, *vsb1;
int i, nfd, asock;
- char abuf[128], pbuf[128];
+ char abuf[VTCP_ADDRBUFSIZE];
+ char pbuf[VTCP_PORTBUFSIZE];
+ char lbuf[PATH_MAX];
struct pollfd fd[3];
enum VCLI_status_e u;
const char *err;
@@ -506,19 +508,19 @@ varnish_launch(struct varnish *v)
if (u != CLIS_AUTH)
vtc_fatal(v->vl, "CLI auth demand expected: %u %s", u, r);
- bprintf(abuf, "%s/_.secret", v->workdir);
- nfd = open(abuf, O_RDONLY);
+ bprintf(lbuf, "%s/_.secret", v->workdir);
+ nfd = open(lbuf, O_RDONLY);
assert(nfd >= 0);
- assert(sizeof abuf >= CLI_AUTH_RESPONSE_LEN + 7);
- bstrcpy(abuf, "auth ");
- VCLI_AuthResponse(nfd, r, abuf + 5);
+ assert(sizeof lbuf >= CLI_AUTH_RESPONSE_LEN + 7);
+ bstrcpy(lbuf, "auth ");
+ VCLI_AuthResponse(nfd, r, lbuf + 5);
closefd(&nfd);
free(r);
r = NULL;
- strcat(abuf, "\n");
+ strcat(lbuf, "\n");
- u = varnish_ask_cli(v, abuf, &r);
+ u = varnish_ask_cli(v, lbuf, &r);
if (vtc_error)
return;
if (u != CLIS_OK)
More information about the varnish-commit
mailing list