From: Alan T. DeKok Date: Mon, 6 Dec 2021 20:24:16 +0000 (-0500) Subject: catch stupidities. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23c0684803581391e69f737fcd7c0e42464ba9ef;p=thirdparty%2Ffreeradius-server.git catch stupidities. A ^= A is wrong A .= A is wrong A UNION A --> A A MERGE A --> A A := A --> A --- diff --git a/src/lib/util/edit.c b/src/lib/util/edit.c index 87765e45ee..b910200249 100644 --- a/src/lib/util/edit.c +++ b/src/lib/util/edit.c @@ -867,21 +867,37 @@ int fr_edit_list_apply_list_assignment(fr_edit_list_t *el, fr_pair_t *dst, fr_to * new list. */ case T_OP_SET: + if (&dst->children == src) return 0; /* A := A == A */ + if (fr_edit_list_free_pair_children(el, dst) < 0) return -1; FALL_THROUGH; case T_OP_ADD_EQ: + if (&dst->children == src) { + fr_strerror_printf("Cannot append list to itself"); + return -1; + } + COPY; return fr_edit_list_insert_list_tail(el, &dst->children, ©); case T_OP_PREPEND: + if (&dst->children == src) { + fr_strerror_printf("Cannot prepend list to itself"); + return -1; + } + COPY; return fr_edit_list_insert_list_head(el, &dst->children, ©); case T_OP_OR_EQ: + if (&dst->children == src) return 0; /* A UNION A == A */ + return list_union(el, dst, src); case T_OP_GE: + if (&dst->children == src) return 0; /* A MERGE A == A */ + return list_merge_lhs(el, dst, src); default: