1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

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
This commit is contained in:
stephan
2023-07-23 22:14:41 +00:00
parent 2ecadd8869
commit 479cfd5af3
3 changed files with 9 additions and 10 deletions

View File

@ -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);