From b2d763580114d0ec563c313364f8e9893762f1fa Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sun, 2 Aug 2020 06:38:22 -0400 Subject: [PATCH] [mod_webdav] fix inadvertent string truncation (bug on master branch; never released) --- src/mod_webdav.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod_webdav.c b/src/mod_webdav.c index edbe5214..3926bd48 100644 --- a/src/mod_webdav.c +++ b/src/mod_webdav.c @@ -928,7 +928,7 @@ webdav_xml_doc_lock_acquired (request_st * const r, /*(http_status is set by caller to 200 OK or 201 Created)*/ char tbuf[32] = "Second-"; - const uint32_t tbuf_len = + const uint32_t tbuf_len = sizeof("Second-")-1 + li_itostrn(tbuf+sizeof("Second-")-1, sizeof(tbuf)-(sizeof("Second-")-1), lockdata->timeout); http_header_response_set(r, HTTP_HEADER_OTHER, @@ -4390,7 +4390,7 @@ mod_webdav_put_linkat_rename (request_st * const r, size_t plen = li_itostrn(pathproc+sizeof("/proc/self/fd/")-1, sizeof(pathproc)-(sizeof("/proc/self/fd/")-1), c->file.fd); - pathproc[plen] = '\0'; + pathproc[sizeof("/proc/self/fd/")-1+plen] = '\0'; if (0 == linkat(AT_FDCWD, pathproc, AT_FDCWD, pathtemp, AT_SYMLINK_FOLLOW)){ struct stat st; #ifdef RENAME_NOREPLACE /*(renameat2() not well-supported yet)*/