aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/btree.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/btree.c b/src/btree.c
index 1eae0ac5d..2c1a9983e 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -6499,7 +6499,13 @@ static int pageInsertArray(
if( pData<pBegin ) return 1;
pSlot = pData;
}
- memcpy(pSlot, pCArray->apCell[i], sz);
+ /* pSlot and pCArray->apCell[i] will never overlap on a well-formed
+ ** database. But they might for a corrupt database. Hence use memmove()
+ ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */
+ assert( (pSlot+sz)<=pCArray->apCell[i]
+ || pSlot>=(pCArray->apCell[i]+sz)
+ || CORRUPT_DB );
+ memmove(pSlot, pCArray->apCell[i], sz);
put2byte(pCellptr, (pSlot - aData));
pCellptr += 2;
}