laudrup/boost-wintls

In sspi_handshake::operator()(), extra buffer handling section should have std::copy, not std::move

mscottmueller opened this issue · 3 comments

  const auto extra_data_begin = input_data_.begin() + previous_size - extra_size;
  const auto extra_data_end = input_data_.begin() + previous_size;

  std::move(extra_data_begin, extra_data_end, input_data_.begin());

Should be

  const auto extra_data_begin = input_data_.begin() + previous_size - extra_size;
  const auto extra_data_end = input_data_.begin() + previous_size;

  std::copy(extra_data_begin, extra_data_end, input_data_.begin());

std::move(extra_data_begin, extra_data_end, input_data_.begin());

@mscottmueller Thanks a lot for your interest in this project.

Not that I think you're wrong in any way but do you think you could explain why std::move is incorrect in this case?

I remember being quite certain that the regions couldn't overlap but I could very well be wrong.

You are also very welcome to open a pull request with the explanation in the commit message.

Thanks.

@mscottmueller

The algorithm header should probably be included anyway but that would also be the case with std::copy.

I'm quite sure there are quite a few missing headers other places as well though. This is not a public header though so I don't consider it to be too much of an issue.