]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephsqlite: fill 0s in unread portion of buffer 53053/head
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 18 Aug 2023 17:43:27 +0000 (13:43 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 23 Aug 2023 00:53:11 +0000 (20:53 -0400)
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 <pdonnell@redhat.com>
src/libcephsqlite.cc

index f1cf0c3f366a49b08499ef4bc2469586a0c0a1d9..b4fb968413bfb0ef962782ab1268b0f2c5acc998 100644 (file)
@@ -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;