« Previous | Next » 

Revision 786e1e87

ID786e1e87129611523cd7cbf255a479fe36dcba66
Parent 100e163d
Child bcb5bdeb

Added by Ben Noordhuis almost 12 years ago

buffer, crypto: fix buffer decoding

Before this commit, DecodeWrite() mistakenly tried to convert buffers to
UTF-8 strings which:

a) produced invalid character sequences when the buffer contained
octets > 127, and
b) lead to spurious test failures because DecodeWrite() wrote less bytes
than DecodeBytes() said it would, with the remainder either containing
zeros or garbage

Fix that by simply copying the buffer's data to the target buffer when the
encoding is BINARY or by converting the buffer to a binary string when it's
UTF8 or ASCII.

Fixes #3651, #3866.

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences