summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-11-23 14:30:39 -0500
committerDavid Robillard <d@drobilla.net>2015-11-23 14:30:39 -0500
commitc8cbb4f24d2b763530785df79c35cf6f2487fe54 (patch)
treeb7f4e65eb99c33d3da68db16ab4a1c99b1446e16 /ingen
parent4f863669ae5015bf0c705537a244e8488212488e (diff)
downloadingen-c8cbb4f24d2b763530785df79c35cf6f2487fe54.tar.gz
ingen-c8cbb4f24d2b763530785df79c35cf6f2487fe54.tar.bz2
ingen-c8cbb4f24d2b763530785df79c35cf6f2487fe54.zip
Fix crash when request contains invalid path URI
Fixes #1108
Diffstat (limited to 'ingen')
-rw-r--r--ingen/Node.hpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/ingen/Node.hpp b/ingen/Node.hpp
index fd001897..640b63cf 100644
--- a/ingen/Node.hpp
+++ b/ingen/Node.hpp
@@ -86,8 +86,14 @@ public:
static Raul::URI root_graph_uri() { return Raul::URI("ingen:/graph"); }
static bool uri_is_path(const Raul::URI& uri) {
- return uri == root_graph_uri() ||
- uri.substr(0, root_graph_uri().length() + 1) == root_graph_uri() + "/";
+ const size_t root_len = root_graph_uri().length();
+ if (uri == root_graph_uri()) {
+ return true;
+ } else if (uri.substr(0, root_len + 1) != root_graph_uri() + "/") {
+ return false;
+ } else {
+ return Raul::URI::is_valid(uri.substr(root_len));
+ }
}
static Raul::Path uri_to_path(const Raul::URI& uri) {