[master] 46901a4d3 avoid potential assertion failures in pan_addr()

Dridi Boukelmoune dridi at varni.sh
Mon Oct 5 13:36:48 UTC 2020


On Mon, Oct 5, 2020 at 12:38 PM Nils Goroll <nils.goroll at uplex.de> wrote:
>
>
> commit 46901a4d32901fd140441046cdf79783391e9a17
> Author: Nils Goroll <nils.goroll at uplex.de>
> Date:   Mon Oct 5 14:35:27 2020 +0200
>
>     avoid potential assertion failures in pan_addr()
>
>     ref 8816c6f9df513ba90ec60712ba629c78fa75ec9c
>
> diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
> index 7364bfdf7..6d7aa5afa 100644
> --- a/bin/varnishd/cache/cache_panic.c
> +++ b/bin/varnishd/cache/cache_panic.c
> @@ -53,6 +53,7 @@
>  #include "vtim.h"
>  #include "vcs.h"
>  #include "vtcp.h"
> +#include "vsa.h"
>
>  /*
>   * The panic string is constructed in a VSB, then copied to the
> @@ -540,6 +541,8 @@ pan_req(struct vsb *vsb, const struct req *req)
>                 char p[VTCP_PORTBUFSIZE];                               \
>                                                                         \
>                 (void) SES_Get_##field##_addr((sp), &sa);               \
> +               if (! VSA_Sane(sa))                                     \
> +                       break;                                          \
>                 VTCP_name(sa, h, sizeof h, p, sizeof p);                \

This should solve the risk of crash in VTCP_name() but session
attributes can still trigger.

>                 VSB_printf((vsb), "%s.ip = %s:%s,\n", #field, h, p);    \
>         } while (0)
> _______________________________________________
> 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