From 5b746b186a9f6681e895c064f72d48f0b456f93b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 26 May 2024 00:13:40 +0200 Subject: [PATCH] Be more strict about possible track/route names The GUI `RouteUI::verify_new_route_name` checks for colons. This left the session vulnerable, from calling set_name from other places (e.g. ctrl surfaces). --- libs/ardour/route.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 6869ec852f..1ba0580111 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -355,6 +355,13 @@ Route::~Route () string Route::ensure_track_or_route_name (string newname) const { + /* remove any colons (and other nasty chars) */ + newname = legalize_for_universal_path (newname); + + /* Some ctrl surfaces may put NULL in the middle of a string. + * Ben found out just how much havoc this can wreak. SysEx 1s 4 b1tch. */ + newname.erase (std::remove (newname.begin(), newname.end(), '\0'), newname.end()); + while (!_session.io_name_is_legal (newname)) { newname = bump_name_once (newname, ' '); if (newname == name()) {