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:
4ca81fb
)
yaz-ztest: Proper 0-terminate user-defined record buffer
author
Adam Dickmeiss
<adam@indexdata.dk>
Tue, 17 Dec 2013 13:58:35 +0000
(14:58 +0100)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Tue, 17 Dec 2013 13:58:58 +0000
(14:58 +0100)
ztest/read-marc.c
patch
|
blob
|
history
diff --git
a/ztest/read-marc.c
b/ztest/read-marc.c
index
7a54ddf
..
585b1ef
100644
(file)
--- a/
ztest/read-marc.c
+++ b/
ztest/read-marc.c
@@
-12,6
+12,7
@@
#include <yaz/wrbuf.h>
#include <yaz/marcdisp.h>
#include <yaz/odr.h>
+#include <yaz/log.h>
#include "ztest.h"
@@
-1708,8
+1709,9
@@
char *dummy_xml_record(int num, ODR odr, const char *esn)
if (stat(wrbuf_cstr(w), &sbuf) == 0 &&
(file = fopen(wrbuf_cstr(w), "rb")))
{
- buf = odr_malloc(odr, sbuf.st_size);
+ buf = odr_malloc(odr, 1 + sbuf.st_size);
fread(buf, 1, sbuf.st_size, file);
+ buf[sbuf.st_size] = '\0';
}
if (file)
fclose(file);