diff --git a/src/dird/catreq.c b/src/dird/catreq.c index b2cd4cc8b04..15ab212e191 100644 --- a/src/dird/catreq.c +++ b/src/dird/catreq.c @@ -659,7 +659,10 @@ bool despool_attributes_from_file(JCR *jcr, const char *file) size += sizeof(int32_t); msglen = ntohl(pktsiz); if (msglen > 0) { - if (msglen > (int32_t) sizeof_pool_memory(msg)) { + /* + * check for msglen + \0 + */ + if ((msglen + 1) > (int32_t) sizeof_pool_memory(msg)) { msg = realloc_pool_memory(msg, msglen + 1); } nbytes = fread(msg, 1, msglen, spool_fd);