Module: kamailio
Branch: master
Commit: 5bbff26ce6e95b841e69f2dffc2214318a748c36
URL:
https://github.com/kamailio/kamailio/commit/5bbff26ce6e95b841e69f2dffc22143…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-12-31T09:35:08+01:00
sca: removed if on rc before being set
- reorder some conditions on range
---
Modified: src/modules/sca/sca_appearance.c
Modified: src/modules/sca/sca_rpc.c
Modified: src/modules/sca/sca_subscribe.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5bbff26ce6e95b841e69f2dffc22143…
Patch:
https://github.com/kamailio/kamailio/commit/5bbff26ce6e95b841e69f2dffc22143…
---
diff --git a/src/modules/sca/sca_appearance.c b/src/modules/sca/sca_appearance.c
index c467137a8d7..fcc94c4c2b6 100644
--- a/src/modules/sca/sca_appearance.c
+++ b/src/modules/sca/sca_appearance.c
@@ -60,7 +60,7 @@ void sca_appearance_state_to_str(int state, str *state_str)
{
assert(state_str != NULL);
- if(state >= SCA_APPEARANCE_STATE_NAME_COUNT || state < 0) {
+ if(state < 0 || state >= SCA_APPEARANCE_STATE_NAME_COUNT) {
state_str->len = SCA_APPEARANCE_STATE_STR_UNKNOWN.len;
state_str->s = SCA_APPEARANCE_STATE_STR_UNKNOWN.s;
diff --git a/src/modules/sca/sca_rpc.c b/src/modules/sca/sca_rpc.c
index c3b9b0f2bae..bedfdaa0162 100644
--- a/src/modules/sca/sca_rpc.c
+++ b/src/modules/sca/sca_rpc.c
@@ -199,10 +199,6 @@ void sca_rpc_deactivate_all_subscriptions(rpc_t *rpc, void *ctx)
rpc->rpl_printf(ctx, "Deactivating %s subscription from %.*s",
sca_event_name_from_type(sub->event),
STR_FMT(&sub->subscriber));
- if(rc < 0) {
- // make sure we unlock below
- break;
- }
rc = sca_notify_subscriber(
sca, sub, SCA_CALL_INFO_APPEARANCE_INDEX_ANY);
diff --git a/src/modules/sca/sca_subscribe.c b/src/modules/sca/sca_subscribe.c
index 6e9949a5d78..895141e1e25 100644
--- a/src/modules/sca/sca_subscribe.c
+++ b/src/modules/sca/sca_subscribe.c
@@ -1426,7 +1426,7 @@ int sca_subscription_reply(sca_mod *scam, int status_code, char
*status_msg,
extra_headers.s = hdr_buf;
len = snprintf(extra_headers.s, sizeof(hdr_buf), "Event: %s%s",
sca_event_name_from_type(event_type), CRLF);
- if(len >= sizeof(hdr_buf) || len < 0) {
+ if(len < 0 || len >= sizeof(hdr_buf)) {
LM_ERR("sca_subscription_reply: extra headers too long\n");
return (-1);
}
@@ -1446,7 +1446,7 @@ int sca_subscription_reply(sca_mod *scam, int status_code, char
*status_msg,
len = snprintf(extra_headers.s + extra_headers.len,
sizeof(hdr_buf) - extra_headers.len, "Expires: %d%s", expires,
CRLF);
- if(len >= (sizeof(hdr_buf) - extra_headers.len) || len < 0) {
+ if(len < 0 || len >= (sizeof(hdr_buf) - extra_headers.len)) {
LM_ERR("sca_subscription_reply: extra headers too long\n");
return (-1);
}