Opened 11 years ago
Closed 6 years ago
#6187 closed Bugs (invalid)
boost::filesystem::exists will thought a string is which include zero, is a file, exactly is the file is not exist.
| Reported by: | Owned by: | Beman Dawes | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | filesystem |
| Version: | Boost 1.48.0 | Severity: | Problem |
| Keywords: | filesystem | Cc: |
Description
A string like this; std::string path = "/usr/lib/"; path.append(2, 0x0); path.append(3, 'x');
boost::filesystem::exists function will thought this 'path' is a directory.
thanks regards.
Change History (3)
comment:1 by , 11 years ago
| Component: | None → filesystem |
|---|---|
| Owner: | set to |
comment:2 by , 6 years ago
comment:3 by , 6 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
It isn't the job of class path to decide on validity of strings passed to it.
Asian character encodings may have embedded '\0' characters. Shift-JIS is an example, IIRC. If you know the encoding of a string that is going to be used as a path, you could check it for validity before passing it to a path.
Thanks,
--Beman
Note:
See TracTickets
for help on using tickets.

Hello,
I have opened a pull-request with the fix here: https://github.com/boostorg/filesystem/pull/28