View source code
Display the source code in dmd/root/filename.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function dmd.root.filename.FileName.safeSearchPath

Search Path for file in a safe manner.

static extern(C++) const(char)* safeSearchPath (
  dmd.root.array.Array!(const(char)*)* path,
  const(char)* name
);

Be wary of CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') attacks.

http

//cwe.mitre.org/data/definitions/22.html More info:

https

//www.securecoding.cert.org/confluence/display/c/FIO02-C.+Canonicalize+path+names+originating+from+tainted+sources

Returns

NULL file not found !=NULL mem.xmalloc'd file name

Authors

Walter Bright, http://www.digitalmars.com

License

Boost License 1.0