Boost C++ Libraries: Ticket #4640: Fixed-sized array constructor can have unintended consequences https://svn.boost.org/trac10/ticket/4640 <p> As initially reported here: <a class="ext-link" href="http://article.gmane.org/gmane.comp.lib.boost.devel/208444"><span class="icon">​</span>http://article.gmane.org/gmane.comp.lib.boost.devel/208444</a> </p> <p> The fixed-size array constructor takes the whole array, not accounting for possible null-terminators in the array. </p> <p> Here is a more obvious test case that shows the problem: </p> <pre class="wiki">void array_ctor_test() { char buf[256]; strcpy(buf, "mydir/mysubdir"); bfs::path p1(buf); bfs::path p2(&amp;buf[0]); assert(p1 == p2); // Passes, because char-compares up to null p1 /= "extra"; p2 /= "extra"; assert(p1 == p2); // fail } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4640 Trac 1.4.3 Beman Dawes Wed, 01 Dec 2010 20:43:10 GMT <link>https://svn.boost.org/trac10/ticket/4640#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4640#comment:1</guid> <description> <p> This was fixed by changeset 64986, August 24, 2010. </p> <p> Thanks, </p> <p> --Beman </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Sat, 04 Dec 2010 13:07:04 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4640#comment:2 https://svn.boost.org/trac10/ticket/4640#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket