]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert "Keep too-long lines from overwriting output_buffer (#5093)"
authorAlan T. DeKok <aland@freeradius.org>
Mon, 7 Aug 2023 13:48:36 +0000 (09:48 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 7 Aug 2023 13:48:36 +0000 (09:48 -0400)
This reverts commit b69393030a90e01aa9ff592d0171333efa1c3498.

You can use "goto" to jump into another block, but that won't
cause the compiler to treat variables of the same name as identical.

src/bin/unit_test_module.c

index f1365c169754f0ea9696a7554c857688c3ce24e9..5122718ecf1a75c66d57a9ff343440a8291409b5 100644 (file)
@@ -418,14 +418,8 @@ static bool do_xlats(fr_event_list_t *el, char const *filename, FILE *fp)
                        }
 
                        if (fr_sbuff_remaining(&line) > 0) {
-                               int err_len;
-                       too_much_text:
-                               err_len = strlen("ERROR offset " " 'Too much text' ::" "::") + 4 +
-                                         fr_sbuff_remaining(&line);
-                               if (err_len > (int) sizeof(output_buff) - 1) err_len = (int) sizeof(output_buff) - 1;
                                talloc_free(xlat_ctx);
-                               fr_sbuff_in_sprintf(&out, "ERROR offset %d 'Too much text' ::%.*s::",
-                                                   (int) slen, err_len, fr_sbuff_current(&line));
+                               fr_sbuff_in_sprintf(&out,  "ERROR offset %d 'Too much text' ::%s::", (int) slen, fr_sbuff_current(&line));
                                continue;
                        }
 
@@ -471,7 +465,11 @@ static bool do_xlats(fr_event_list_t *el, char const *filename, FILE *fp)
                                continue;
                        }
 
-                       if (fr_sbuff_remaining(&line) > 0) goto too_much_text;
+                       if (fr_sbuff_remaining(&line) > 0) {
+                               talloc_free(xlat_ctx);
+                               fr_sbuff_in_sprintf(&out, "ERROR offset %d 'Too much text' ::%s::", (int) slen, fr_sbuff_current(&line));
+                               continue;
+                       }
 
                        if (xlat_resolve(head, NULL) < 0) {
                                talloc_free(xlat_ctx);