From 788569aa714cfdfce28df2257dd9923e81b053dc Mon Sep 17 00:00:00 2001 From: Alexandra Titoc Date: Mon, 9 Sep 2024 15:58:24 +0300 Subject: [PATCH 1/9] lib/hash.c: Fix undefined shift operation CID #216641 --- lib/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hash.c b/lib/hash.c index 9aa50a6b016..8f2129dc89d 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -28,7 +28,7 @@ gen_hash_t *hash_init(unsigned int size) gen_lock_set_t *locks = NULL; /* initialized the hash table */ - for (n=0 ; n<(8*sizeof(n)) ; n++) { + for (n=0 ; n<(8*sizeof(n) - 1) ; n++) { if (size==(1< Date: Mon, 9 Sep 2024 16:46:28 +0300 Subject: [PATCH 2/9] httpd/httpd_proc.c: Resolve memory leak CID #216631 --- modules/httpd/httpd_proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/httpd/httpd_proc.c b/modules/httpd/httpd_proc.c index b8bf42b76c3..a4069d93832 100644 --- a/modules/httpd/httpd_proc.c +++ b/modules/httpd/httpd_proc.c @@ -751,6 +751,7 @@ void httpd_proc(int rank) cert_pem = load_file(tls_cert_file.s); if (NULL == cert_pem) { + free(key_pem); LM_ERR("unable to load tls certificate\n"); return; } From da403505fbd0c7f1ca642731a04f8c96ac9afaa6 Mon Sep 17 00:00:00 2001 From: Alexandra Titoc Date: Mon, 9 Sep 2024 17:49:18 +0300 Subject: [PATCH 3/9] usrloc: Fix print format specifier CID #199937 --- modules/usrloc/ul_mi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/usrloc/ul_mi.c b/modules/usrloc/ul_mi.c index 07318d0348d..2b7f1d0eeb3 100644 --- a/modules/usrloc/ul_mi.c +++ b/modules/usrloc/ul_mi.c @@ -115,7 +115,7 @@ static inline int mi_add_aor_node(mi_item_t *aor_item, urecord_t* r, if (add_mi_string(ct_item, MI_SSTR("Contact"), c->c.s, c->c.len) < 0) return -1; - if (add_mi_string_fmt(ct_item, MI_SSTR("ContactID"), "%llu", c->contact_id) < 0) + if (add_mi_string_fmt(ct_item, MI_SSTR("ContactID"), "%lu", c->contact_id) < 0) return -1; if (c->expires == 0) { From d6b396ef484a09f84402f2dcfaa528e85031183d Mon Sep 17 00:00:00 2001 From: Alexandra Titoc Date: Mon, 9 Sep 2024 18:18:40 +0300 Subject: [PATCH 4/9] cfg.y: Fix printf argument CID #417573 --- cfg.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg.y b/cfg.y index 3b4660e045b..222fa86d9f3 100644 --- a/cfg.y +++ b/cfg.y @@ -622,7 +622,7 @@ port: NUMBER { $$=$1; } portrange: portrange COMMA NUMBER MINUS NUMBER { IFOR(); if ($3 > $5) { - yyerrorf("invalid port range (%d > %d)\n", $3, $5); + yyerrorf("invalid port range (%d > %d)\n", (int)$3, (int)$5); YYABORT; } pr_tmp = mk_port_range($3, $5); From 719688def68d4bb193fa4fdc40405b9c14c1a205 Mon Sep 17 00:00:00 2001 From: Alexandra Titoc Date: Mon, 9 Sep 2024 18:26:36 +0300 Subject: [PATCH 5/9] lib/dbg/struct_hist.c: End variable argument processing CID #417586 --- lib/dbg/struct_hist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dbg/struct_hist.c b/lib/dbg/struct_hist.c index ef57793fff5..ff219e52571 100644 --- a/lib/dbg/struct_hist.c +++ b/lib/dbg/struct_hist.c @@ -274,6 +274,7 @@ int _sh_log(osips_realloc_f realloc_f, struct struct_hist *sh, if (!new) { lock_release(&sh->wlock); LM_ERR("oom\n"); + va_end(ap); return -1; } /* CAREFUL: newly added actions are not memset, for speed reasons! */ From b91771305be59c8dff207db81ca480a552a2b0be Mon Sep 17 00:00:00 2001 From: Alexandra Titoc Date: Mon, 9 Sep 2024 18:37:43 +0300 Subject: [PATCH 6/9] proto_ipsec: Switch the position of arguments CID #417603 --- modules/proto_ipsec/proto_ipsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/proto_ipsec/proto_ipsec.c b/modules/proto_ipsec/proto_ipsec.c index 683a1bc35fc..f884cabca7d 100644 --- a/modules/proto_ipsec/proto_ipsec.c +++ b/modules/proto_ipsec/proto_ipsec.c @@ -1310,7 +1310,7 @@ static void ipsec_usrloc_restore(ucontact_t *contact) return; } - ctx = ipsec_ctx_new(&sa, &user->ip, ss, sc, &ck, &ik, spi_ps, spi_pc); + ctx = ipsec_ctx_new(&sa, &user->ip, ss, sc, &ck, &ik, spi_pc, spi_ps); if (!ctx) { LM_ERR("could not allocate new IPSec ctx\n"); goto release_user; From c6af7410449ce61899783fb61b937c8bb2530f87 Mon Sep 17 00:00:00 2001 From: Alexandra Titoc Date: Mon, 9 Sep 2024 18:41:16 +0300 Subject: [PATCH 7/9] dprint.c: Remove extra argument in printf CID #417643 --- dprint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dprint.c b/dprint.c index 417faba72cb..64233c88cfc 100644 --- a/dprint.c +++ b/dprint.c @@ -427,7 +427,7 @@ static int log_print_json(str *buf, enum log_json_format json_fmt, char *time, l = log_escape_json_buf(log_msg_buf, l, p, buf->len - len - rlen - 1); if (l < 0) { - stderr_dprint_tmp_err("failed to escape log message!\n",l); + stderr_dprint_tmp_err("failed to escape log message!\n"); return -1; } From 7e9c98e86a7e0349badbd8646f976ab2d174b497 Mon Sep 17 00:00:00 2001 From: Alexandra Titoc Date: Mon, 9 Sep 2024 18:49:16 +0300 Subject: [PATCH 8/9] cfg.y: Fix printf argument CID #417573 --- cfg.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg.y b/cfg.y index 222fa86d9f3..6f260fc5005 100644 --- a/cfg.y +++ b/cfg.y @@ -644,7 +644,7 @@ portrange: portrange COMMA NUMBER MINUS NUMBER { IFOR(); } | NUMBER MINUS NUMBER { IFOR(); if ($1 > $3) { - yyerrorf("invalid port range (%d > %d)\n", $1, $3); + yyerrorf("invalid port range (%d > %d)\n", (int)$1, (int)$3); YYABORT; } $$=mk_port_range($1, $3); From ea5cd0a89708f29ad28734bd2340ad1b6dbccba3 Mon Sep 17 00:00:00 2001 From: Alexandra Titoc Date: Wed, 11 Sep 2024 10:15:44 +0300 Subject: [PATCH 9/9] mem: Fix format specifier in DBG_SHM_ALLOC macro for size argument CID #417720, #417787, #417724 --- mem/shm_mem_dbg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mem/shm_mem_dbg.h b/mem/shm_mem_dbg.h index 5f18a19ab32..33c4ba425e1 100644 --- a/mem/shm_mem_dbg.h +++ b/mem/shm_mem_dbg.h @@ -34,7 +34,7 @@ shm_skip_sh_log = 1; \ hist = _sh_push(p, shm_hist, 1, \ shm_dbg_malloc_func, shm_dbg_free_func); \ - _sh_log(shm_dbg_realloc_func, hist, (verb), "%s:%s:%d, %d", \ + _sh_log(shm_dbg_realloc_func, hist, (verb), "%s:%s:%d, %lu", \ file, function, line, size); \ /* on oom, we'd rather crash here */ \ _sh_unref(hist, shm_dbg_free_func); \