/* 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
#include <yaz/wrbuf.h>
#include <yaz/marcdisp.h>
#include <yaz/odr.h>
+#include <yaz/log.h>
#include "ztest.h"
#include <sys/stat.h>
#endif
+#include <stdlib.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
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);