Skip to content

Commit

Permalink
Enforce prefix and suffix format for cipher_add_random
Browse files Browse the repository at this point in the history
  • Loading branch information
developernotes committed Nov 26, 2013
1 parent b5ece46 commit 4b31a37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/crypto_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' */
Expand Down

0 comments on commit 4b31a37

Please sign in to comment.