]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
vps may be NULL. Fixes #1778
authorAlan T. DeKok <aland@freeradius.org>
Tue, 11 Oct 2016 16:54:54 +0000 (12:54 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 11 Oct 2016 16:54:54 +0000 (12:54 -0400)
The VERIFY_LIST macro shouild be protected by an "if *vps" check.
It should also be run once all of the VPs have been added,
and not on every VP which is added.

src/modules/rlm_perl/rlm_perl.c

index 3a01ea91c82105c2b4cbe8e8efce97a98a6a0c96..73db48a76592065042add7e06fb1d2c7b1352921 100644 (file)
@@ -700,8 +700,6 @@ static void pairadd_sv(TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR **vps, char
        VALUE_PAIR      *vp;
        STRLEN len;
 
-       VERIFY_LIST(*vps);
-
        if (!SvOK(sv)) {
        fail:
                REDEBUG("Failed to create pair &%s:%s %s $%s{'%s'} -> '%s'", list_name, key,
@@ -752,6 +750,8 @@ static void get_hv_content(TALLOC_CTX *ctx, REQUEST *request, HV *my_hv, VALUE_P
                        pairadd_sv(ctx, request, vps, key, res_sv, T_OP_EQ, hash_name, list_name);
                }
        }
+
+       if (*vps) VERIFY_LIST(*vps);
 }
 
 /*