mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
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
This commit is contained in:
10
src/btree.c
10
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);
|
||||
|
Reference in New Issue
Block a user