diff options
author | drh <> | 2024-02-26 15:27:33 +0000 |
---|---|---|
committer | drh <> | 2024-02-26 15:27:33 +0000 |
commit | 7c6433cfff58499a7ee2c9b103590359e0cf5226 (patch) | |
tree | d04b22a2245bcdb6ef83ab0a52195e31863bed87 /src/btree.c | |
parent | 09e1900cdcd40548a8d1dfb15076f77c80e492c7 (diff) | |
download | sqlite-7c6433cfff58499a7ee2c9b103590359e0cf5226.tar.gz sqlite-7c6433cfff58499a7ee2c9b103590359e0cf5226.zip |
When inserting a 3-byte cell into a btree, ensure that the extra padding byte
is 0x00. This is not necessary for security, as far as I can tell, but it
seems like a reasonable precaution.
FossilOrigin-Name: 5766f1279dab91e030d4dcf5133659e5cedf914a1628ccf00d67d8e50a9957fd
Diffstat (limited to 'src/btree.c')
-rw-r--r-- | src/btree.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/btree.c b/src/btree.c index 16b683abe..3e08dc6a1 100644 --- a/src/btree.c +++ b/src/btree.c @@ -7007,7 +7007,10 @@ static int fillInCell( n = nHeader + nPayload; testcase( n==3 ); testcase( n==4 ); - if( n<4 ) n = 4; + if( n<4 ){ + n = 4; + pPayload[nPayload] = 0; + } *pnSize = n; assert( nSrc<=nPayload ); testcase( nSrc<nPayload ); @@ -9453,7 +9456,10 @@ int sqlite3BtreeInsert( if( flags & BTREE_PREFORMAT ){ rc = SQLITE_OK; szNew = p->pBt->nPreformatSize; - if( szNew<4 ) szNew = 4; + if( szNew<4 ){ + szNew = 4; + newCell[3] = 0; + } if( ISAUTOVACUUM(p->pBt) && szNew>pPage->maxLocal ){ CellInfo info; pPage->xParseCell(pPage, newCell, &info); |