- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Section 5.2 of the Tutorial (Open Source).pdf on the website contains the following code snippet.
void Append( concurrent_vector& vector, const char* string ) {
size_t n = strlen(string)+1;
memcpy( &vector[vector.grow_by(n)], string, n+1 );
}
Isn't this copying the null terminated string plus an additional byte to the vector?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for catching and reporting the error! Though it looks like someone has already fixed it by rewriting the memcpy line in the following way
std::copy( string, string+n, vector.begin()+vector.grow_by(n) );
Not sure if this version has already been released, but at least it is what I see in our mainline at the moment. Anyway, thanks again, and don't hesitate posting other errors you may find (you evidently have a sharp eye), there is a good chance that they are still lying about nonfixed
.
std::copy( string, string+n, vector.begin()+vector.grow_by(n) );
Not sure if this version has already been released, but at least it is what I see in our mainline at the moment. Anyway, thanks again, and don't hesitate posting other errors you may find (you evidently have a sharp eye), there is a good chance that they are still lying about nonfixed

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page