diff options
Diffstat (limited to 'encode.c')
-rw-r--r-- | encode.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/encode.c b/encode.c index ecc5b63..e8674ad 100644 --- a/encode.c +++ b/encode.c @@ -194,6 +194,10 @@ _line_append(char *dst, const char *src, int *len) ret = realloc(dst, rlen+1); if (ret == NULL) return NULL; + if (dst == NULL) + /* this ensures that the first byte strlcat() + * encounters is a null byte */ + memset(ret, 0, rlen+1); strlcat(ret, src, rlen+1); strlcat(ret, "\n", rlen+1); |