[v3] Fix stringbuf handling of NUL characters
Benjamin Kosnik
bkoz@gnu.org
Fri Jul 13 13:40:00 GMT 2001
> 1 std::string string_with_nulls ("123 \0 456", 9);
> 2 std::stringbuf sbuf (string_with_nulls);
>
> sbuf.str().size() should be 9, but right now, it's only 4. The user in
> the original bug report was constructing (indirectly) a string like the
> one on line 1. But inside istringstream, when we created its stringbuf
> with something like line 2, we were allowing a strlen() call to determine
> how much data to copy.
Ok. With this, and assuming you made the change to string::data(), I think
this is ready to go in as well.
thanks again,
benjamin
More information about the Libstdc++
mailing list