os: add invalid path exception to Path_base

In case the path is invalid during import raise the 'Path_invalid'
exception.

Issue #4088
This commit is contained in:
Josef Söntgen
2021-04-23 17:35:44 +02:00
committed by Norman Feske
parent 8f30fc993d
commit ddf6a0c276

View File

@ -30,6 +30,7 @@ class Genode::Path_base
public: public:
class Path_too_long { }; class Path_too_long { };
class Path_invalid { };
protected: protected:
@ -196,6 +197,9 @@ class Genode::Path_base
void import(char const *path, char const *pwd = 0) void import(char const *path, char const *pwd = 0)
{ {
if (!path)
throw Path_invalid();
/* /*
* Validate 'pwd' argument, if not supplied, enforce invariant * Validate 'pwd' argument, if not supplied, enforce invariant
* that 'pwd' is an absolute path. * that 'pwd' is an absolute path.