]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add missing return
authorAlan T. DeKok <aland@freeradius.org>
Wed, 3 Jan 2024 14:17:11 +0000 (09:17 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 3 Jan 2024 14:18:03 +0000 (09:18 -0500)
src/lib/util/calc.c
src/tests/keywords/edit-underflow [new file with mode: 0644]

index 948d617c8625dec9e0031fbe2c24c84a7f3e71a1..e721a926907a85c400bf5870feed74521d5ba7e3 100644 (file)
@@ -2445,7 +2445,7 @@ int fr_value_calc_assignment_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_token_t
                }
        }
 
-       if (rcode < 0) handle_result(dst->type, op, rcode);
+       if (rcode < 0) return handle_result(dst->type, op, rcode);
 
        return 0;
 }
diff --git a/src/tests/keywords/edit-underflow b/src/tests/keywords/edit-underflow
new file mode 100644 (file)
index 0000000..2d69d86
--- /dev/null
@@ -0,0 +1,29 @@
+uint32 one
+uint32 two
+
+#
+#  PRE: edit
+#
+&one := 4
+&two := 5
+
+#
+#  First modification succeeds.  The second modification fails, which
+#  also reverts the changes to the first one.
+#
+transaction {
+       &one += 5
+       &two -= 16      # Run-time underflow!
+}
+
+#
+#  The various edits above should have been reverted.
+#
+if !(&one == 4) {
+       test_fail
+}
+
+if !(&two == 5) {
+       test_fail
+}
+success