January 30, 2014 import expression with paths | ||||
---|---|---|---|---|
| ||||
This does not compile on Windows, but does compile on Mac: --- module main; void main() { import std.path; enum bar = import(`dir` ~ dirSeparator ~ `bar.txt`); } --- The docs say: http://dlang.org/expression.html#ImportExpression "Implementations may restrict the file name in order to avoid directory traversal security vulnerabilities. A possible restriction might be to disallow any path components in the file name." So, I suppose it's valid code. But it's still surprising to encounter. Should it not simply be disallowed completely? |
Copyright © 1999-2021 by the D Language Foundation