From 85cbeccd3e1217af84291981d3d8a0ea12207067 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 14 Feb 2008 18:15:26 +0000 Subject: [PATCH] Check for malformed trace paths that do not start with '/'. --- src/core/trace-resolver.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index 6569e206d..2c0c34aa0 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -19,6 +19,7 @@ * Author: Mathieu Lacage */ #include "trace-resolver.h" +#include "assert.h" #include "log.h" NS_LOG_COMPONENT_DEFINE ("TraceResolver"); @@ -53,6 +54,10 @@ TraceResolver::GetElement (std::string path) { std::string::size_type cur = 1; // check that first char is "/" + if (path[0] != '/') + { + NS_FATAL_ERROR ("Malformed trace path (must start with '/'): '" << path << "'"); + } std::string::size_type next = path.find ("/", cur); std::string id = std::string (path, cur, next-1); return id; @@ -62,6 +67,10 @@ TraceResolver::GetSubpath (std::string path) { std::string::size_type cur = 1; // check that first char is "/" + if (path[0] != '/') + { + NS_FATAL_ERROR ("Malformed trace path (must start with '/'): '" << path << "'"); + } std::string::size_type next = path.find ("/", cur); std::string subpath; if (next != std::string::npos)