opt code
This commit is contained in:
parent
32b5ec1da7
commit
abc4a3768f
|
@ -251,7 +251,7 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
|
|||
printf("ERROR: Encrypt key overflow, it should be at most %d characters\n", ENCRYPT_KEY_LEN);
|
||||
return TSDB_CODE_INVALID_CFG;
|
||||
}
|
||||
tstrncpy(global.encryptKey, argv[i], ENCRYPT_KEY_LEN);
|
||||
tstrncpy(global.encryptKey, argv[i], ENCRYPT_KEY_LEN + 1);
|
||||
} else {
|
||||
printf("'-y' requires a parameter\n");
|
||||
return TSDB_CODE_INVALID_CFG;
|
||||
|
|
|
@ -230,7 +230,7 @@ static int32_t dmWriteCheckCodeFile(char *file, char *realfile, char *key, bool
|
|||
}
|
||||
|
||||
SCryptOpts opts;
|
||||
tstrncpy(opts.key, key, ENCRYPT_KEY_LEN);
|
||||
tstrncpy(opts.key, key, ENCRYPT_KEY_LEN + 1);
|
||||
opts.len = len;
|
||||
opts.source = DM_KEY_INDICATOR;
|
||||
opts.result = result;
|
||||
|
@ -349,7 +349,7 @@ static int32_t dmCompareEncryptKey(char *file, char *key, bool toLogFile) {
|
|||
}
|
||||
|
||||
SCryptOpts opts = {0};
|
||||
strncpy(opts.key, key, ENCRYPT_KEY_LEN);
|
||||
tstrncpy(opts.key, key, ENCRYPT_KEY_LEN + 1);
|
||||
opts.len = len;
|
||||
opts.source = content;
|
||||
opts.result = result;
|
||||
|
|
|
@ -510,7 +510,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) {
|
|||
opts.source = pRaw->pData;
|
||||
opts.result = newData;
|
||||
opts.unitLen = 16;
|
||||
tstrncpy(opts.key, tsEncryptKey, ENCRYPT_KEY_LEN);
|
||||
tstrncpy(opts.key, tsEncryptKey, ENCRYPT_KEY_LEN + 1);
|
||||
|
||||
int32_t count = CBC_Encrypt(&opts);
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno, int32_t encryptAlgor
|
|||
opts.result = PacketData;
|
||||
opts.unitLen = 128;
|
||||
// strncpy(opts.key, tsEncryptKey, 16);
|
||||
tstrncpy(opts.key, encryptKey, ENCRYPT_KEY_LEN);
|
||||
tstrncpy(opts.key, encryptKey, ENCRYPT_KEY_LEN + 1);
|
||||
|
||||
NewLen = CBC_Decrypt(&opts);
|
||||
|
||||
|
|
Loading…
Reference in New Issue