Opened 12 years ago
Closed 12 years ago
#4640 closed Bugs (fixed)
Fixed-sized array constructor can have unintended consequences
Reported by: | Owned by: | Beman Dawes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | filesystem |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | fixed size array constructor | Cc: |
Description
As initially reported here: http://article.gmane.org/gmane.comp.lib.boost.devel/208444
The fixed-size array constructor takes the whole array, not accounting for possible null-terminators in the array.
Here is a more obvious test case that shows the problem:
void array_ctor_test() { char buf[256]; strcpy(buf, "mydir/mysubdir"); bfs::path p1(buf); bfs::path p2(&buf[0]); assert(p1 == p2); // Passes, because char-compares up to null p1 /= "extra"; p2 /= "extra"; assert(p1 == p2); // fail }
Change History (2)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
This was fixed by changeset 64986, August 24, 2010.
Thanks,
--Beman