X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ztest%2Fread-marc.c;h=0b9dc1d387b37ff02d7236ca4755c82584e7e92d;hp=7a54ddf3bedeae6a199b1d88017b34a0c061b166;hb=dc86a5103817732735d2591d3775114a86de94ae;hpb=cca8a96be6d6ce6de52009e53e23876ce2fc195c diff --git a/ztest/read-marc.c b/ztest/read-marc.c index 7a54ddf..0b9dc1d 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2013 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** \file @@ -12,6 +12,7 @@ #include #include #include +#include #include "ztest.h" @@ -25,6 +26,7 @@ #include #endif +#include #if HAVE_UNISTD_H #include #endif @@ -1708,8 +1710,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);