1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Work around a "security feature" bug in memcpy() on OpenBSD.

FossilOrigin-Name: fab6f09044d033dd09ed8a22e06bc6a7851bbabf
This commit is contained in:
drh
2015-10-10 16:41:28 +00:00
parent 72724da95a
commit 48310f8c51
3 changed files with 14 additions and 8 deletions

View File

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