[Asterisk-code-review] res_stir_shaken: Use ast_asprintf for creating file path. (asterisk[16])
Joshua Colp
asteriskteam at digium.com
Thu Oct 1 05:30:50 CDT 2020
Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15029 )
Change subject: res_stir_shaken: Use ast_asprintf for creating file path.
......................................................................
res_stir_shaken: Use ast_asprintf for creating file path.
Change-Id: Ice5d92ecea2f1101c80487484f48ef98be2f1824
---
M res/res_stir_shaken.c
1 file changed, 3 insertions(+), 6 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/29/15029/1
diff --git a/res/res_stir_shaken.c b/res/res_stir_shaken.c
index 3f79596..97fb177 100644
--- a/res/res_stir_shaken.c
+++ b/res/res_stir_shaken.c
@@ -462,9 +462,6 @@
/* 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 @@
/* 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)) {
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15029
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ice5d92ecea2f1101c80487484f48ef98be2f1824
Gerrit-Change-Number: 15029
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201001/dafc3100/attachment-0001.html>
More information about the asterisk-code-review
mailing list