Check for malformed trace paths that do not start with '/'.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#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)
|
||||
|
||||
Reference in New Issue
Block a user