From d94684c1ee3d1436c878fe5d33ea27b2eb1144d5 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Fri, 18 Aug 2023 13:43:27 -0400 Subject: [PATCH] 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 --- src/libcephsqlite.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcephsqlite.cc b/src/libcephsqlite.cc index f1cf0c3f366a..b4fb968413bf 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; -- 2.47.3