[master] 5e5b442f5 VSLb() is not the choice for a single string argument
Dridi Boukelmoune
dridi at varni.sh
Wed Jul 20 15:31:11 UTC 2022
On Wed, Jul 20, 2022 at 3:29 PM Nils Goroll <nils.goroll at uplex.de> wrote:
>
>
> commit 5e5b442f53d27cfa6000f9bc7694fbce5a46af5c
> Author: Nils Goroll <nils.goroll at uplex.de>
> Date: Wed Jul 20 17:24:46 2022 +0200
>
> VSLb() is not the choice for a single string argument
>
> spotted by gcc 9.4.0:
>
> error: format not a string literal and no format arguments
> [-Werror=format-security]
>
> diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
> index be3d56768..312ca0d01 100644
> --- a/bin/varnishd/cache/cache_vrt.c
> +++ b/bin/varnishd/cache/cache_vrt.c
> @@ -976,7 +976,7 @@ VRT_CacheReqBody(VRT_CTX, VCL_BYTES maxsize)
> CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
> if (ctx->method != VCL_MET_RECV) {
> if (ctx->vsl != NULL) {
> - VSLb(ctx->vsl, SLT_VCL_Error, err);
> + VSLbs(ctx->vsl, SLT_VCL_Error, TOSTRAND(err));
Wouldn't this also work?
VSLb(ctx->vsl, SLT_VCL_Error, "%s", err);
> } else {
> AN(ctx->msg);
> VSB_printf(ctx->msg, "%s\n", err);
> _______________________________________________
> varnish-commit mailing list
> varnish-commit at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
More information about the varnish-commit
mailing list