Fix BytesToString indexing array using wrong index

This would lead to reading past the end of the buffer and also writing
past the end of the newly allocated buffer.

Bug #1121
pull/870/head
Victor Julien 11 years ago
parent 88e9c85e36
commit 00d2f2d627

@ -57,9 +57,9 @@ char *BytesToString(const uint8_t *bytes, size_t nbytes)
/* no nulls */
memcpy(string, bytes, nbytes);
} else {
/* no nulls present */
/* nulls present */
char *dst = string;
for (u = 0; u < n; u++) {
for (u = 0; u < nbytes; u++) {
if (bytes[u] == '\0') {
*dst++ = '\\';
*dst++ = '0';

Loading…
Cancel
Save