projects
/
yaz-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f43cb30
)
odr_create_Odr_oct: null terminate the buffer
author
Adam Dickmeiss
<adam@indexdata.dk>
Tue, 1 Oct 2013 18:03:10 +0000
(20:03 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Tue, 1 Oct 2013 18:03:10 +0000
(20:03 +0200)
Some applications rely on it :-)
src/odr_mem.c
patch
|
blob
|
history
diff --git
a/src/odr_mem.c
b/src/odr_mem.c
index
28181e3
..
690477d
100644
(file)
--- 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;
}