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: v17.2.7~65^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=bfcf6ebf83545242c35213372f75e711fbbc0693;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 (cherry picked from commit d94684c1ee3d1436c878fe5d33ea27b2eb1144d5) --- diff --git a/src/libcephsqlite.cc b/src/libcephsqlite.cc index eafadcd8922bd..52cfded7312c4 100644 --- a/src/libcephsqlite.cc +++ b/src/libcephsqlite.cc @@ -296,7 +296,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;