1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-05 04:30:38 +03:00

Do not overrun a buffer in the genfkey code (now part of shell.c). Fix for #3722. (CVS 6344)

FossilOrigin-Name: 943b11fb188835f0c62b6064b084192b1bbe1c0c
This commit is contained in:
danielk1977
2009-03-13 15:32:53 +00:00
parent 2fe5cb1809
commit 9365c6760a
3 changed files with 10 additions and 9 deletions

View File

@@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.205 2009/03/05 03:48:07 shane Exp $
** $Id: shell.c,v 1.206 2009/03/13 15:32:53 danielk1977 Exp $
*/
#if defined(_WIN32) || defined(WIN32)
/* This needs to come before any includes for MSVC compiler */
@@ -625,9 +625,10 @@ static void multireplace(
}
}
if( (nOut+nCopy)>nMalloc ){
nMalloc += (nMalloc + 16);
nMalloc = 16 + (nOut+nCopy)*2;
zOut = (char *)sqlite3_realloc(zOut, nMalloc);
}
assert( nMalloc>=(nOut+nCopy) );
memcpy(&zOut[nOut], zCopy, nCopy);
i += nReplace;
nOut += nCopy;