diff --git a/src/calibre/utils/podofo/output.cpp b/src/calibre/utils/podofo/output.cpp index 015949502a..d72fd316fe 100644 --- a/src/calibre/utils/podofo/output.cpp +++ b/src/calibre/utils/podofo/output.cpp @@ -40,7 +40,7 @@ class OutputDevice : public PdfOutputDevice { char *buf; int res, len=1024; while(true) { - buf = new (std::nothrow) char[len]; + buf = new (std::nothrow) char[len+1]; if (buf == NULL) { PyErr_NoMemory(); throw pyerr(); } res = vsnprintf(buf, len, pszFormat, args); delete[] buf;