Change in libosmocore[master]: vty: Avoid ultra-long multi-line strings cluttering talloc reports

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Jul 15 10:23:50 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/19272 )


Change subject: vty: Avoid ultra-long multi-line strings cluttering talloc reports
......................................................................

vty: Avoid ultra-long multi-line strings cluttering talloc reports

The talloc_asprintf() series includes an unconditional call to
talloc_set_name_const(), turning the entire long constructed string
into the name of the talloc object.  That simply doesn't work when
creating kilobytes-sized VTY reference strings including linefeeds.

Let's add an explicit talloc_set_name_const() to prevent this.

Change-Id: Ibd77684b88cc3572047daa98c9a6b9119fba041b
Closes: OS#4668
---
M src/vty/logging_vty.c
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/72/19272/1

diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index c51b437..0e1782a 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -337,6 +337,9 @@
 	osmo_talloc_asprintf(tall_log_ctx, cmd_str, ") %s", level_args);
 	osmo_talloc_asprintf(tall_log_ctx, doc_str, "%s", level_strs);
 
+	talloc_set_name_const(cmd_str, "vty_log_level_cmd_str");
+	talloc_set_name_const(doc_str, "vty_log_level_doc_str");
+
 	cmd->string = cmd_str;
 	cmd->doc = doc_str;
 }
@@ -1048,6 +1051,9 @@
 	osmo_talloc_asprintf(tall_log_ctx, doc_str,
 			     "Arbitrary message to log on given category and log level\n");
 
+	talloc_set_name_const(cmd_str, "vty_logp_cmd_str");
+	talloc_set_name_const(doc_str, "vty_logp_doc_str");
+
 	cmd->string = cmd_str;
 	cmd->doc = doc_str;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19272
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibd77684b88cc3572047daa98c9a6b9119fba041b
Gerrit-Change-Number: 19272
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200715/eef41324/attachment.htm>


More information about the gerrit-log mailing list