X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ztest%2Fread-marc.c;h=585b1ef8538e8db220e8f79aae3ff7c59225f70b;hp=7a54ddf3bedeae6a199b1d88017b34a0c061b166;hb=777b03337c9a5d14ed30c65e48a7a13eb1993536;hpb=4ca81fbf3665bcd33a53c8b860de9dd5dfbd63a8 diff --git a/ztest/read-marc.c b/ztest/read-marc.c index 7a54ddf..585b1ef 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -12,6 +12,7 @@ #include #include #include +#include #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);