Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sanitize filenames when using "archive_groupname" (#1383)
This feature (used, very possibly, only by me, for debugging) lets me force OSL to write an archive that contains the oso files and a serialized version of the shader network. If no explicit name is given (by the "archive_filename" attribute), it picks a name based on the shader group name. But that may not be a safe string for a valid filename. We already eliminated anything before the last slash, but it turns out that a colon (':') and pipe ('|') can also really mess things up. So this small change protects against that. For the actual commands sent to system(), escape special characters in the strings and enclose any arguments that come from the user in double quotes. That prevents shenanigans like asking for an archive filename called "; rm -r *". By enclosing in double quotes, we'll end up with a badly named filename produced by tar, rather than possibly an arbitrary command being executed. Signed-off-by: Larry Gritz <[email protected]>
- Loading branch information