From 4db187fbff08310195d08260817d7aa63f1fa4bc Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 1 Oct 2013 20:03:10 +0200 Subject: [PATCH] odr_create_Odr_oct: null terminate the buffer Some applications rely on it :-) --- src/odr_mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/odr_mem.c b/src/odr_mem.c index 28181e3..690477d 100644 --- a/src/odr_mem.c +++ b/src/odr_mem.c @@ -65,8 +65,9 @@ size_t odr_total(ODR o) Odr_oct *odr_create_Odr_oct(ODR o, const char *buf, int sz) { Odr_oct *p = (Odr_oct *) odr_malloc(o, sizeof(Odr_oct)); - p->buf = (char *) odr_malloc(o, sz); + p->buf = (char *) odr_malloc(o, sz + 1); memcpy(p->buf, buf, sz); + p->buf[sz] = '\0'; p->len = sz; return p; } -- 1.7.10.4