From: Alan T. DeKok Date: Sat, 26 May 2012 08:32:58 +0000 (+0200) Subject: VP may be NULL X-Git-Tag: release_2_2_0~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5724a49fb7938002fec8f9c7f1db452e4ac750ba;p=thirdparty%2Ffreeradius-server.git VP may be NULL --- diff --git a/src/main/xlat.c b/src/main/xlat.c index 64a1d8d338b..37ec1a84bad 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -100,11 +100,11 @@ static VALUE_PAIR *pairfind_tag(VALUE_PAIR *vps, int attr, int tag) VALUE_PAIR *vp = vps; redo: - if (!vp) return NULL; - vp = pairfind(vp, attr); if (!tag) return vp; + if (!vp) return NULL; + if (!vp->flags.has_tag) return NULL; if (vp->flags.tag == tag) return vp; @@ -317,6 +317,8 @@ static size_t xlat_packet(void *instance, REQUEST *request, * Non-existent array reference. */ just_print: + if (!vp) return 0; + if (do_number) { if ((vp->type != PW_TYPE_IPADDR) && (vp->type != PW_TYPE_INTEGER) && @@ -330,7 +332,6 @@ static size_t xlat_packet(void *instance, REQUEST *request, return snprintf(out, outlen, "%u", vp->vp_integer); } - if (!vp) return 0; return valuepair2str(out, outlen, vp, da->type, func); }