Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Get the buffer's address _after_ resize() is called.

resize() might call realloc on the buffer which will of course change
its address, so we may not get that address before the resize() call.
  • Loading branch information...
commit 0d114affe48b1c573644bdc91515da9b88d70d5a 1 parent 3522e44
Tilman Sauerbeck authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/strbuf.c
View
4 src/strbuf.c
@@ -91,7 +91,7 @@ void
strbuf_append_encoded (StrBuf *sb, const uint8_t *other)
{
static const char hex[16] = "0123456789abcdef";
- char *dest = sb->buf + sb->length;
+ char *dest;
int len = 0;
for (const uint8_t *src = other; *src; src++) {
@@ -105,6 +105,8 @@ strbuf_append_encoded (StrBuf *sb, const uint8_t *other)
resize (sb, len);
+ dest = sb->buf + sb->length;
+
for (const uint8_t *src = other; *src; src++) {
if (GOODCHAR (*src)) {
*dest++ = *src;
Please sign in to comment.
Something went wrong with that request. Please try again.