Module: kamailio
Branch: master
Commit: 0f3fb6b8cb04162be07e9246c23bcfa8b8e4e4e6
URL:
https://github.com/kamailio/kamailio/commit/0f3fb6b8cb04162be07e9246c23bcfa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-24T13:00:44+02:00
xmlrpc: handle return codes
---
Modified: src/modules/xmlrpc/xmlrpc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0f3fb6b8cb04162be07e9246c23bcfa…
Patch:
https://github.com/kamailio/kamailio/commit/0f3fb6b8cb04162be07e9246c23bcfa…
---
diff --git a/src/modules/xmlrpc/xmlrpc.c b/src/modules/xmlrpc/xmlrpc.c
index ef1535cc88..61b73d0993 100644
--- a/src/modules/xmlrpc/xmlrpc.c
+++ b/src/modules/xmlrpc/xmlrpc.c
@@ -654,7 +654,7 @@ static int fix_delayed_reply_ctx(rpc_ctx_t* ctx)
{
if ((ctx->flags & XMLRPC_DELAYED_CTX_F) && (ctx->reply.buf.s==0)){
if (init_xmlrpc_reply(&ctx->reply) <0) return -1;
- add_xmlrpc_reply(&ctx->reply, &success_prefix);
+ if(add_xmlrpc_reply(&ctx->reply, &success_prefix)<0) return -1;
if (ctx->flags & RET_ARRAY)
return add_xmlrpc_reply(&ctx->reply, &array_prefix);
}
@@ -787,7 +787,7 @@ static int get_rpc_document(str* doc, sip_msg_t* msg)
*/
static int send_reply(sip_msg_t* msg, str* body)
{
- if (add_lump_rpl(msg, body->s, body->len, LUMP_RPL_BODY) < 0) {
+ if (add_lump_rpl(msg, body->s, body->len, LUMP_RPL_BODY) == 0) {
ERR("Error while adding reply lump\n");
return -1;
}
@@ -1965,6 +1965,7 @@ static int rpc_struct_scan(struct rpc_struct* s, char* fmt, ...)
break;
default:
ERR("Invalid parameter type in formatting string: %c\n", *fmt);
+ va_end(ap);
return -1;
}
fmt++;
@@ -2176,7 +2177,7 @@ static int init_context(rpc_ctx_t* ctx, sip_msg_t* msg)
ctx->doc = 0;
ctx->structs = 0;
if (init_xmlrpc_reply(&ctx->reply) < 0) return -1;
- add_xmlrpc_reply(&ctx->reply, &success_prefix);
+ if (add_xmlrpc_reply(&ctx->reply, &success_prefix)<0) return -1;
if (open_doc(ctx, msg) < 0) return -1;
return 0;
}
@@ -2367,7 +2368,9 @@ static int process_xmlrpc(sip_msg_t* msg)
n_method = method[0] + (method[1] << 8) + (method[2] << 16) +
(method[3] << 24);
n_method |= 0x20202020;
- n_method &= ((method_len < 4) * (1U << method_len * 8) - 1);
+ if(method_len < 4) {
+ n_method &= ((1U << (method_len * 8)) - 1);
+ }
/* accept only GET or POST */
if ((n_method == N_HTTP_GET) ||
((n_method == N_HTTP_POST) && (method_len == HTTP_POST_LEN))) {