From: Patrick Donnelly Date: Fri, 18 Aug 2023 17:43:27 +0000 (-0400) Subject: libcephsqlite: fill 0s in unread portion of buffer X-Git-Tag: v19.0.0~631^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d94684c1ee3d1436c878fe5d33ea27b2eb1144d5;p=ceph.git libcephsqlite: fill 0s in unread portion of buffer Unfortunately, this code is filling 0s at the beginning of the short-read buffer. Fixes: https://tracker.ceph.com/issues/62492 Signed-off-by: Patrick Donnelly --- diff --git a/src/libcephsqlite.cc b/src/libcephsqlite.cc index f1cf0c3f366a4..b4fb968413bfb 100644 --- a/src/libcephsqlite.cc +++ b/src/libcephsqlite.cc @@ -353,7 +353,7 @@ static int Read(sqlite3_file *file, void *buf, int len, sqlite_int64 off) auto end = ceph::coarse_mono_clock::now(); getdata(f->vfs).logger->tinc(P_OPF_READ, end-start); if (rc < len) { - memset(buf, 0, len-rc); + memset((unsigned char*)buf+rc, 0, len-rc); return SQLITE_IOERR_SHORT_READ; } else { return SQLITE_OK;