Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity #3472

Merged
merged 114 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
777fe76
cachedb_dynamodb: Initialize 'con' pointer and remove unnecessary if …
oanatitoc Sep 13, 2024
adb1296
cachedb_dynamodb: Fix some resource leaks
oanatitoc Sep 13, 2024
a1b9210
blacklists.c: Fix null pointer dereferences
oanatitoc Sep 16, 2024
d58c173
db: Fix possible buffer overflow
oanatitoc Sep 16, 2024
1a43c56
dprint.c: Fix memory leak
oanatitoc Sep 16, 2024
6159df1
evi: Treat negative return value
oanatitoc Sep 16, 2024
0206bbe
evi: Fix 'evi_remove_expired_subs' function flow
oanatitoc Sep 16, 2024
bb6bb87
lib/reg/common.h: Fix time_t truncation issue in log output
oanatitoc Sep 16, 2024
755f80d
mem: Fix incomplete read handling
oanatitoc Sep 17, 2024
a53e789
mem: Add missing file descriptor close
oanatitoc Sep 17, 2024
ed90a5d
aaa_diameter: Remove redundant assigment
oanatitoc Sep 17, 2024
d8bcc14
aaa_diameter: Fix memory leak
oanatitoc Sep 17, 2024
e44cf7e
mem: Fix null pointer dereference
oanatitoc Sep 17, 2024
603e40a
aaa_diameter: Fix out-of-bounds read
oanatitoc Sep 17, 2024
3ce2ccf
aaa_diameter: Fix incorrect null check
oanatitoc Sep 17, 2024
be12ccf
aaa_radius: Check pointer result
oanatitoc Sep 17, 2024
45bf0b1
acc: Cast time_t to appropriate types
oanatitoc Sep 18, 2024
3d46dfc
acc: Add coverity tag
oanatitoc Sep 18, 2024
fe3fc86
auth_aka: Fix null dereference issue
oanatitoc Sep 18, 2024
641d928
auth_aka: Fix incorrect sizeof argument
oanatitoc Sep 18, 2024
a89dc7a
auth_jwt: Add null check before dereferencing
oanatitoc Sep 18, 2024
9cfec5c
b2b_entities: Add proper null checks
oanatitoc Sep 18, 2024
2e875be
b2b_entities: Add tag coverity
oanatitoc Sep 18, 2024
459bc62
b2b_entitites: Fix potential null pointer dereference
oanatitoc Sep 18, 2024
cd151c7
b2b_logic: Remove unnecessary if block
oanatitoc Sep 18, 2024
ae478cb
b2b_logic: Initialize callid to prevent usage of uninitialized variable
oanatitoc Sep 18, 2024
171ae7e
b2b_logic: Fix cast from time_t to int error
oanatitoc Sep 18, 2024
074faf9
b2b_logic: Add coverity tag
oanatitoc Sep 18, 2024
0ca7a9e
b2b_logic: Add null check for entity
oanatitoc Sep 18, 2024
1de7a40
acc: Fix time_t cast
oanatitoc Sep 18, 2024
4c0564b
b2b_logic: Prevent null dereferencing
oanatitoc Sep 23, 2024
1e2c348
b2b_logic: Add null checks
oanatitoc Sep 23, 2024
0988f5d
b2b_logic: Fix possible copy-paste error
oanatitoc Sep 23, 2024
e67887a
b2b_logic: Ensure signed comparison
oanatitoc Sep 23, 2024
1d516d3
b2b_sdp_demux: Cast time_t to int
oanatitoc Sep 23, 2024
97434d9
b2b_sdp_demux: Check 'str2int' return value
oanatitoc Sep 23, 2024
a474aad
cachedb_mongodb: Check return value
oanatitoc Sep 23, 2024
841c81e
cachedb_mongodb: Cast time_t to int
oanatitoc Sep 23, 2024
8932a1f
cachedb_sgl: Add coverity adnotation
oanatitoc Sep 23, 2024
bbdf66f
cachedb_sql: Cast time_t to int
oanatitoc Sep 23, 2024
42a6e94
call_center: Cast time_t to int
oanatitoc Sep 23, 2024
7f4e23a
carrierroute: Add return to avoid null pointer dereferencing
oanatitoc Sep 23, 2024
48976ac
carrierroute: Add null check
oanatitoc Sep 23, 2024
f469cfc
carrierroute: Fix pointer comparison with 0
oanatitoc Sep 23, 2024
424638f
cfgutils: Add null check
oanatitoc Sep 24, 2024
a343bc8
clusterer: Cast time_t to int
oanatitoc Sep 24, 2024
cc6a609
clusterer: Add coverity tags
oanatitoc Sep 24, 2024
b2ee5c9
acc: Add coverity tags
oanatitoc Sep 24, 2024
4c8fc99
clusterer: Fix unterminated case
oanatitoc Sep 24, 2024
72dad82
clusterer: Add Null check to avoid Null dereferences
oanatitoc Sep 24, 2024
56b218b
compression: Fix potential copy-paste error
oanatitoc Sep 24, 2024
8cfb66b
compression: Add and fix null checks
oanatitoc Sep 24, 2024
55243c9
compression: Fix sign extension issue
oanatitoc Sep 24, 2024
6fd0454
cpl_c: Cast time_t to unsigned int
oanatitoc Sep 24, 2024
9733f60
cpl_c: Add coverity tags
oanatitoc Sep 24, 2024
1e4bd24
db_http: Fix copy-paste error
oanatitoc Sep 24, 2024
aeb58cc
db_http: Check return value
oanatitoc Sep 24, 2024
9e8b505
db_perlvdb: Cast time_t
oanatitoc Sep 24, 2024
6fdc967
db_sqlite: Add null check
oanatitoc Sep 24, 2024
9138313
db_http: Fix compile error
oanatitoc Sep 25, 2024
bbb13de
db_text: Add null check
oanatitoc Sep 25, 2024
ab9d70a
db_text: Add coverity tag
oanatitoc Sep 25, 2024
56b9b11
db_text: Cast time_t
oanatitoc Sep 25, 2024
5088dfe
dialog: Cast time_t
oanatitoc Sep 25, 2024
bd0989c
dialog: Fix potential copy-paste error
oanatitoc Sep 25, 2024
33f655c
dialog: Add null check
oanatitoc Sep 25, 2024
3f04771
dispatcher: Check return value and remove redundant assign
oanatitoc Sep 25, 2024
d1ebc22
dns_cache: Fix null pointer dereference
oanatitoc Sep 25, 2024
cb86f64
db_sqlite: Remove redundand assign
oanatitoc Sep 25, 2024
1cae53a
dialog: Fix the use of an uninitialized variable
oanatitoc Sep 25, 2024
9158f41
emergency: Add null check
oanatitoc Sep 25, 2024
902a142
emergency: Jump to error in case of a null value
oanatitoc Sep 25, 2024
9aaa0b3
emergency: Add null check before dereferencing pointer
oanatitoc Sep 25, 2024
a527811
emergency: Cast time_t
oanatitoc Sep 25, 2024
2c6eaf8
emergency: Add null check before dereferencing
oanatitoc Sep 25, 2024
884e537
emergency: Fix resource leak
oanatitoc Sep 25, 2024
12c95f8
emergency: Check return code
oanatitoc Sep 25, 2024
37aab40
event_kafka: Dereference after null check and add coverity tag
oanatitoc Sep 25, 2024
b198bfe
event_rabbitmq: Initialize tmp fields and dereference rmqp pointer af…
oanatitoc Sep 25, 2024
6b6c045
event_stream: Add '> 0' check in case buf.len is negative
oanatitoc Sep 25, 2024
d68659c
emergency: Fix compile errrors
oanatitoc Sep 26, 2024
f8bb0d1
fraud_detection: Add coverity tag and cast time_t
oanatitoc Sep 26, 2024
89063ac
group: Add coverity tag and check null pointer
oanatitoc Sep 26, 2024
3664fed
httpd: Treat negative return of ftell function
oanatitoc Sep 26, 2024
ebfeb66
identity: Add null check
oanatitoc Sep 26, 2024
1776ace
identity: Init value to prevent using uninitialized value
oanatitoc Sep 26, 2024
e7c2ffa
imc: Fix if condition
oanatitoc Sep 26, 2024
e4fc135
imc: Fix null pointer dereference
oanatitoc Sep 26, 2024
6b99355
jabber: Fix null pointer dereference
oanatitoc Sep 26, 2024
607d178
jabber: Check null pointer
oanatitoc Sep 26, 2024
bcd461f
ldam: Add null check
oanatitoc Sep 26, 2024
7eb84c8
media_exchange: Fix null pointer dereference
oanatitoc Sep 27, 2024
d4f5374
mangler & maxfwd: Add coverity tag
oanatitoc Sep 27, 2024
1ae87bf
media_exchange: Fix use of uninitialized value
oanatitoc Sep 27, 2024
647d38e
mediaproxy: Add null check
oanatitoc Sep 27, 2024
0a48fdc
mi_fifo: Fix storage leak
oanatitoc Sep 27, 2024
aeb89f6
mi_script: Check return code
oanatitoc Sep 27, 2024
bbee136
mid_registrar: Fix out-of-bounds access
oanatitoc Sep 30, 2024
4475ae3
mid_registrar: Cast time_t
oanatitoc Sep 30, 2024
1d05904
mid_registrar: Fix null pointer dereference
oanatitoc Sep 30, 2024
8e10dd7
mqueue: Handle return value errors
oanatitoc Sep 30, 2024
2c98b69
msilo: Cast time_t
oanatitoc Sep 30, 2024
288a987
msrp_gateway: Add coverity tag
oanatitoc Sep 30, 2024
bc50d4d
msrp_ua: Cast time_t
oanatitoc Sep 30, 2024
149d2e2
nat_traversal: Check return value
oanatitoc Sep 30, 2024
a9249ad
nat_traversal: Cast time_t
oanatitoc Sep 30, 2024
b7fdd94
nathelper: Cast time_t
oanatitoc Sep 30, 2024
3b7b736
Coverity PR: Fix some minor issues or add improvements
liviuchircu Sep 30, 2024
2c2b399
clusterer: fallback, not break, on no cluster_id
razvancrainea Sep 30, 2024
ee842d6
Revert "db_http: Fix copy-paste error"
razvancrainea Sep 30, 2024
fc9a9e4
db_http: suppress Coverity warning
razvancrainea Sep 30, 2024
e7d12e6
db_http,emergency: complete 9138313995
razvancrainea Sep 30, 2024
a8ac11e
imc: proper handling when no rooms are available
razvancrainea Sep 30, 2024
ca65023
jabber: proper check of NULL return
razvancrainea Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions blacklists.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,11 @@ static int parse_ip_net(char *in, int len, struct net *ipnet)
}

ip_tmp = (af == AF_INET) ? str2ip(&ip_s) : str2ip6(&ip_s);
if (!ip_tmp) {
LM_ERR("Invalid IP address\n");
return -1;
}

/* save the IP */
ip = *ip_tmp;

Expand Down
3 changes: 3 additions & 0 deletions db/db_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,14 @@ int db_do_insert(const db_con_t* _h, const db_key_t* _k, const db_val_t* _v,

for (i=0;i<no_rows;i++)
{
if (off + 1 >= SQL_BUF_LEN) goto error0;
sql_buf[off++]='(';
ret = db_print_values(_h, sql_buf + off, SQL_BUF_LEN - off,
CON_HAS_PS(_h)?_v:buffered_rows[i], _n, val2str);
if (ret < 0) goto error;
off += ret;

if (off + 1 >= SQL_BUF_LEN) goto error0;
sql_buf[off++]=')';

if (i != (no_rows -1))
Expand Down
1 change: 1 addition & 0 deletions dprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ int init_log_cee_hostname(void)
init_str(&cname, info->ai_canonname);
if (pkg_str_dup(&log_cee_hostname, &cname) < 0) {
LM_ERR("no more pkg memory\n");
freeaddrinfo(info);
return -1;
}
}
Expand Down
10 changes: 9 additions & 1 deletion evi/event_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void evi_remove_expired_subs(event_id_t id) {
while (subs) {
if (!subs->reply_sock) {
LM_ERR("unknown destination\n");
continue;
goto next_sub;
}
/* check expire */
if (!(subs->reply_sock->flags & EVI_PENDING) &&
Expand All @@ -163,6 +163,8 @@ void evi_remove_expired_subs(event_id_t id) {
}
continue;
}
next_sub:
prev = subs;
subs = subs->next;
}
lock_release(events[id].lock);
Expand Down Expand Up @@ -769,6 +771,9 @@ mi_response_t *w_mi_subscribers_list_1(const mi_params_t *params,
return init_mi_error(404, MI_SSTR("Event not published"));
/* get the event id & before printing the subs list check for any expired subscribers and remove them*/
evid = evi_get_id(&event_s);
if (evid == -1)
return init_mi_error(404, MI_SSTR("Can't get the id"));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra tab is required

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing that out!

evi_remove_expired_subs(evid);

return mi_subscribers_list(event, NULL);
Expand All @@ -790,6 +795,9 @@ mi_response_t *w_mi_subscribers_list_2(const mi_params_t *params,
return init_mi_error(404, MI_SSTR("Event not published"));
/* get the event id & before printing the subs list check for any expired subscribers and remove them*/
evid = evi_get_id(&event_s);
if (evid == -1)
return init_mi_error(404, MI_SSTR("Can't get the id"));

evi_remove_expired_subs(evid);

if (get_mi_string_param(params, "socket", &subs_s.s, &subs_s.len) < 0)
Expand Down
4 changes: 2 additions & 2 deletions lib/reg/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ static inline time_t randomize_expires(unsigned int expires_ts)
expires_dur = max_expires;

ret = expires_dur + get_act_time();
LM_DBG("randomized expiry ts from %u to %lld (adj: %d/%d, "
LM_DBG("randomized expiry ts from %u to %lld (adj: %d/%lld, "
"max_deviation: %d)\n", expires_ts, (long long)ret, expires_adj,
(int)ret - (int)expires_ts, expires_max_deviation);
(long long)ret - (long long)expires_ts, expires_max_deviation);

return ret;
}
Expand Down
4 changes: 3 additions & 1 deletion mem/rpm_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,9 @@ int load_rpm_file(void)
bytes_needed = sizeof(tmp);
do {
ret = read(fd, ((char *)&tmp) + bytes_read, bytes_needed);
if (ret < 0 && errno != EINTR) {
if (ret < 0) {
if (errno == EINTR)
continue;
LM_ERR("could not read from restart persistency file: %s (%d: %s)\n",
rpm_mem_file, errno, strerror(errno));
close(fd);
Expand Down
1 change: 1 addition & 0 deletions mem/shm_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ int shm_dbg_mem_init(void)
default:
LM_ERR("current build does not include support for "
"selected allocator (%s)\n", mm_str(mem_allocator_shm));
close(fd_dbg);
return -1;
}
#endif
Expand Down
3 changes: 2 additions & 1 deletion mem/shm_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,8 @@ inline static void shm_force_unlock(void)
for (i = 0; i < HP_HASH_SIZE; i++)
lock_release(&mem_locks[i]);
} else {
shm_unlock();
if (mem_lock)
shm_unlock();
}
#elif defined HP_MALLOC
int i;
Expand Down
9 changes: 8 additions & 1 deletion modules/aaa_diameter/app_opensips/avps.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ int parse_attr_def(char *line, FILE *fp)
goto error;

nt_name = malloc(name_len + 1);
if (!nt_name) {
LOG_ERROR("Malloc failed\n");
return -1;
}
memcpy(nt_name, name, name_len);
nt_name[name_len] = '\0';

Expand Down Expand Up @@ -637,7 +641,6 @@ int parse_attr_def(char *line, FILE *fp)
goto error;

len -= newp - p;
p = newp;
}

if (avp_type != AVP_TYPE_GROUPED)
Expand All @@ -659,11 +662,13 @@ int parse_attr_def(char *line, FILE *fp)

if (avp_count >= 128) {
LOG_ERROR("max AVP count exceeded (128)\n");
free(nt_name);
return -1;
}

if (parse_avp_def(avps, &avp_count, p, len) != 0) {
LOG_ERROR("failed to parse Grouped sub-AVP line: '%s'\n", line);
free(nt_name);
return -1;
}
}
Expand All @@ -674,6 +679,7 @@ create_avp:;
if (enc_type != AVP_ENC_TYPE_NONE &&
dm_enc_add((vendor_id != -1?vendor_id:0), avp_code, enc_type) != 0) {
LOG_ERROR("failed to add encoding type\n");
free(nt_name);
return -1;
}

Expand Down Expand Up @@ -723,6 +729,7 @@ create_avp:;
return 0;
error:
LOG_ERROR("failed to parse line: %s\n", line);
free(nt_name);
return -1;
}

Expand Down
8 changes: 5 additions & 3 deletions modules/aaa_diameter/dm_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,8 @@ int dm_enc_add(int vendor, int code, enum dict_avp_enc_type enc)
for (i = 0; i < dict_avp_enc_vendors_no; i++)
if (v[i].vendor > vendor)
break;
memmove(&v[i+1], &v[i], (dict_avp_enc_vendors_no - i) * sizeof *v);
if (i < dict_avp_enc_vendors_no)
memmove(&v[i+1], &v[i], (dict_avp_enc_vendors_no - i) * sizeof *v);
v = v + i;
dict_avp_enc_vendors_no++;
v->vendor = vendor;
Expand All @@ -2272,15 +2273,16 @@ int dm_enc_add(int vendor, int code, enum dict_avp_enc_type enc)
} else {
/* resize the avps */
a = realloc(v->avps, (v->avps_no + 1) * sizeof *a);
if (!v) {
if (!a) {
LM_ERR("oom for reallocating avps encoding\n");
return -1;
}
v->avps = a;
for (i = 0; i < v->avps_no; i++)
if (a[i].code > code)
break;
memmove(&a[i+1], &a[i], (v->avps_no - i) * sizeof *a);
if (i < v->avps_no)
memmove(&a[i+1], &a[i], (v->avps_no - i) * sizeof *a);
a = a + i;
v->avps_no++;
}
Expand Down
5 changes: 4 additions & 1 deletion modules/aaa_radius/rad.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ uint32_t rc_get_ipaddr (char *host)
struct in_addr** addr_list;

he=resolvehost(host, 0/*do test if is ip*/);

if (!he) {
LM_ERR("Can't resolve host: %s\n", host);
return 0;
}
/* FIXME the function is not for IPV6 */
addr_list = (struct in_addr **)he->h_addr_list;
if (addr_list[0])
Expand Down
16 changes: 12 additions & 4 deletions modules/acc/acc.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ int acc_log_request( struct sip_msg *rq, struct sip_msg *rpl)

if (ctx) {
/* get created value from context */
_created = ctx->created;
_created = (unsigned int)(unsigned long)ctx->created;
_setup_time = time(NULL) - _created;
}

Expand Down Expand Up @@ -862,7 +862,7 @@ int acc_aaa_request( struct sip_msg *req, struct sip_msg *rpl)
}

if (ctx) {
_created = ctx->created;
_created = (unsigned int)(unsigned long)ctx->created;
_setup_time = time(NULL) - _created;
}

Expand Down Expand Up @@ -1012,7 +1012,7 @@ int acc_aaa_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)
ADD_AAA_AVPAIR( offset + nr_leg_vals + 2, &av_type, -1);

/* Sip-Call-Created (229) */
av_type = ctx->created;
av_type = (uint32_t)(unsigned long)ctx->created;
ADD_AAA_AVPAIR( offset + nr_leg_vals + 3, &av_type, -1);

/* Sip-Call-MSDuration (230) */
Expand Down Expand Up @@ -1234,7 +1234,7 @@ int acc_evi_request( struct sip_msg *rq, struct sip_msg *rpl, int missed_flag)
return 1;

if (ctx) {
_created = ctx->created;
_created = (unsigned int)(unsigned long)ctx->created;
_setup_time = time(NULL) - _created;
}

Expand All @@ -1255,12 +1255,14 @@ int acc_evi_request( struct sip_msg *rq, struct sip_msg *rpl, int missed_flag)

for (extra=evi_leg_tags, nr_leg_vals=0; extra; extra=extra->next, nr_leg_vals++);

/* coverity[overrun-buffer-val: FALSE] */
if (missed_flag && evi_param_set_int(acc_env.ev_params[m+nr_leg_vals],
&_setup_time) < 0) {
LM_ERR("cannot set setuptime parameter\n");
goto end;
}

/* coverity[overrun-buffer-val: FALSE] */
if (missed_flag && evi_param_set_int(acc_env.ev_params[m+nr_leg_vals+1],
&_created) < 0) {
LM_ERR("cannot set created parameter\n");
Expand Down Expand Up @@ -1369,20 +1371,26 @@ int acc_evi_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)

ms_duration = TIMEVAL_MS_DIFF(start_time, ctx->bye_time);
duration = ceil((double)ms_duration/1000);

/* coverity[overrun-buffer-val: FALSE] */
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+1], &duration) < 0) {
LM_ERR("cannot set duration parameter\n");
goto end;
}

/* coverity[overrun-buffer-val: FALSE] */
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+2], &ms_duration) < 0) {
LM_ERR("cannot set duration parameter\n");
goto end;
}
setup_duration = start_time.tv_sec - ctx->created;

/* coverity[overrun-buffer-val: FALSE] */
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+3], &setup_duration) < 0) {
LM_ERR("cannot set setuptime parameter\n");
goto end;
}

if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+4], &ctx->created) < 0) {
LM_ERR("cannot set created parameter\n");
goto end;
Expand Down
1 change: 1 addition & 0 deletions modules/acc/acc_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ static inline void acc_onreply_in(struct cell *t, struct sip_msg *req,
|| (is_invite(t)
&& code >= 300
&& is_mc_acc_on(ctx->flags)))) {
/* coverity[check_return: FALSE] */
parse_headers(reply, HDR_TO_F, 0 );
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/auth_aka/aka_av_mgm.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ int aka_av_get_new_wait(struct aka_user *user, int algmask,
*av = aka_av_get_state(user, algmask, AKA_AV_NEW); /* one last time */
if (cond_has_timedout(&user->cond))
break;
if (!av) {
if (*av == NULL) {
/* compute the drift/reminder */
clock_gettime(CLOCK_REALTIME, &end);
milliseconds -= (end.tv_sec - begin.tv_sec) * 1000 +
Expand Down
2 changes: 1 addition & 1 deletion modules/auth_aka/auth_aka.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ static int aka_challenge(struct sip_msg *_msg, struct aka_av_mgm *mgm, str *_rea

realm = (_realm?*_realm:str_init(""));
if (count > 1) {
avs = pkg_malloc(count * sizeof *av);
avs = pkg_malloc(count * sizeof *avs);
if (!avs) {
LM_ERR("could not allocate %d AVs\n", count);
return -1;
Expand Down
9 changes: 5 additions & 4 deletions modules/auth_jwt/auth_jwt_certops.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@ int extract_pub_key_from_cert(struct sip_msg* _msg, str* cert,

/* TODO - if x5c just add beggining & end */

if (cert == NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent tabs

LM_ERR("Failed to parse certificate\n");
return -1;
}

bio = BIO_new_mem_buf((void*)cert->s,cert->len);
if (!bio) {
LM_ERR("Unable to create BIO buf\n");
return -1;
}

x509cert = PEM_read_bio_X509(bio, NULL, 0, NULL);
if (cert == NULL) {
LM_ERR("Failed to parse certificate\n");
goto err_free;
}

if ((pubkey = X509_get_pubkey(x509cert)) == NULL) {
LM_ERR("Failed to get pub key from certificate\n");
Expand Down
4 changes: 2 additions & 2 deletions modules/b2b_entities/b2be_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ static inline b2b_dlginfo_t *b2b_new_dlginfo(str *callid, str *fromtag, str *tot
dlg->callid.s = (char *)(dlg + 1);
dlg->callid.len = callid->len;
memcpy(dlg->callid.s, callid->s, callid->len);
if (totag->s) {
if (totag && totag->s) {
dlg->totag.len = totag->len;
dlg->totag.s = dlg->callid.s + dlg->callid.len;
memcpy(dlg->totag.s, totag->s, totag->len);
}
if (fromtag->s) {
if (fromtag && fromtag->s) {
dlg->fromtag.len = fromtag->len;
dlg->fromtag.s = dlg->callid.s + dlg->callid.len + dlg->totag.len;
memcpy(dlg->fromtag.s, fromtag->s, fromtag->len);
Expand Down
2 changes: 2 additions & 0 deletions modules/b2b_entities/dlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3046,6 +3046,7 @@ void b2b_tm_cback(struct cell *t, b2b_table htable, struct tmcb_params *ps)
}
else
{
/* coverity[var_deref_model] */
dlg = b2b_search_htable_dlg(htable, hash_index, local_index,
&from_tag, (method_id==METHOD_CANCEL)?NULL:&to_tag, &callid);
}
Expand Down Expand Up @@ -3100,6 +3101,7 @@ void b2b_tm_cback(struct cell *t, b2b_table htable, struct tmcb_params *ps)
"transaction [%p]\n", dlg, dlg->uac_tran, t);
if(dlg_based_search)
/* coverity[swapped_arguments] */
/* coverity[var_deref_model] */
dlg = b2b_search_htable_next_dlg( previous_dlg, htable, hash_index,
local_index, &from_tag, &to_tag, &callid);
else
Expand Down
6 changes: 4 additions & 2 deletions modules/b2b_entities/ua_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,10 @@ struct ua_sess_t_list *insert_ua_sess_tl(str *b2b_key, unsigned int timeout)
tl->next = tmp;
ua_dlg_timer->first = tl;
} else {
tmp->prev->next = tl;
tl->prev = tmp->prev;
if (tmp->prev) {
tmp->prev->next = tl;
tl->prev = tmp->prev;
}
tl->next = tmp;
tmp->prev = tl;
}
Expand Down
7 changes: 2 additions & 5 deletions modules/b2b_logic/b2b_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ int pv_get_entity(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
b2bl_entity_id_t *curr_entities[MAX_BRIDGE_ENT];
b2bl_entity_id_t dummy_entity;
b2b_dlginfo_t dummy_dlginfo;
str callid;
str callid = {NULL, 0};
int i;
int locked = 0;

Expand Down Expand Up @@ -2168,11 +2168,8 @@ static str *b2bl_get_key(void)
int locked = 0;
b2bl_tuple_t *tuple = get_ctx_tuple(&locked);

if (!tuple) {
if (locked)
B2BL_LOCK_RELEASE_AUX(tuple->hash_index);
if (!tuple)
return NULL;
}

ret.s = buf;
ret.len = 0;
Expand Down
Loading