From: Adam Dickmeiss Date: Tue, 1 Oct 2013 18:03:10 +0000 (+0200) Subject: odr_create_Odr_oct: null terminate the buffer X-Git-Tag: v5.0.1~10 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=4db187fbff08310195d08260817d7aa63f1fa4bc;hp=f43cb3097bc38bd3e38c5bb3024d567793ab30fe odr_create_Odr_oct: null terminate the buffer Some applications rely on it :-) --- 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; }