diff options
author | stephan <stephan@noemail.net> | 2023-07-23 22:14:41 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-07-23 22:14:41 +0000 |
commit | 479cfd5af3d46e70468eda8e31c4d033955bdd29 (patch) | |
tree | eba83d2e9383b25118b53c924e4acddebebcb84d /ext/wasm/api | |
parent | 2ecadd8869a5aafeaee736fbfd0dcb15990480c7 (diff) | |
download | sqlite-479cfd5af3d46e70468eda8e31c4d033955bdd29.tar.gz sqlite-479cfd5af3d46e70468eda8e31c4d033955bdd29.zip |
When writing the filename header in a opfs-sahpool file, ensure that all remaining bytes in that part of the header are zeroed out to avoid the downstream problems reported in [forum:d50ec48a293988a5|forum post d50ec48a293988a5].
FossilOrigin-Name: c1b080e39397c983c13a5e79303223827de7b4946c18a79396851ec1814782f3
Diffstat (limited to 'ext/wasm/api')
-rw-r--r-- | ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js index 28524b613..9bf1421a9 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js @@ -654,10 +654,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ */ setAssociatedPath(sah, path, flags){ const enc = textEncoder.encodeInto(path, this.#apBody); - if(HEADER_MAX_PATH_SIZE <= enc.written){ + if(HEADER_MAX_PATH_SIZE <= enc.written + 1/*NUL byte*/){ toss("Path too long:",path); } - + this.#apBody.fill(0, enc.written, HEADER_MAX_PATH_SIZE); this.#dvBody.setUint32(HEADER_OFFSET_FLAGS, flags); const digest = this.computeDigest(this.#apBody); |