Enforce prefix and suffix format for cipher_add_random

This commit is contained in:
Nick Parker 2013-11-26 09:52:55 -06:00
parent b5ece46779
commit 4b31a37006
1 changed files with 2 additions and 1 deletions

View File

@ -1126,7 +1126,8 @@ int sqlcipher_codec_ctx_migrate(codec_ctx *ctx) {
int sqlcipher_codec_add_random(codec_ctx *ctx, const char *zRight){
int random_sz = strlen(zRight);
if (random_sz == ((ctx->read_ctx->key_sz * 2) + 3) && sqlite3StrNICmp((const char *)zRight ,"x'", 2) == 0) {
const char *suffix = &zRight[random_sz-1];
if (sqlite3StrNICmp((const char *)zRight ,"x'", 2) == 0 && sqlite3StrNICmp(suffix, "'", 1) == 0) {
int rc = 0;
unsigned char *random;
int n = random_sz - 3; /* adjust for leading x' and tailing ' */