res_stir_shaken: Use ast_asprintf for creating file path.

Change-Id: Ice5d92ecea2f1101c80487484f48ef98be2f1824
This commit is contained in:
Joshua C. Colp 2020-05-01 09:29:07 -03:00 committed by George Joseph
parent 70af7e1311
commit 0392a8e620
1 changed files with 3 additions and 6 deletions

View File

@ -462,9 +462,6 @@ struct ast_stir_shaken_payload *ast_stir_shaken_verify(const char *header, const
/* If we don't have an entry in AstDB, CURL from the provided URL */
if (ast_strlen_zero(file_path)) {
size_t file_path_size;
/* Remove this entry from the database, since we will be
* downloading a new file anyways.
*/
@ -475,9 +472,9 @@ struct ast_stir_shaken_payload *ast_stir_shaken_verify(const char *header, const
/* Set up the default path */
filename = basename(public_key_url);
file_path_size = strlen(ast_config_AST_DATA_DIR) + 3 + strlen(STIR_SHAKEN_DIR_NAME) + strlen(filename) + 1;
file_path = ast_calloc(1, file_path_size);
snprintf(file_path, sizeof(*file_path), "%s/keys/%s/%s", ast_config_AST_DATA_DIR, STIR_SHAKEN_DIR_NAME, filename);
if (ast_asprintf(&file_path, "%s/keys/%s/%s", ast_config_AST_DATA_DIR, STIR_SHAKEN_DIR_NAME, filename) < 0) {
return NULL;
}
/* Download to the default path */
if (run_curl(public_key_url, file_path)) {