Module: kamailio
Branch: 5.7
Commit: 29b6562d8ebe6277fda5524dda18b88cf2a4e1a9
URL:
https://github.com/kamailio/kamailio/commit/29b6562d8ebe6277fda5524dda18b88…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-03-20T13:42:36+01:00
ctl: handle int input for double storage
(cherry picked from commit 1380a4a0d18159c7130b70c0216134a253ad83f7)
(cherry picked from commit 90f8117f9669069b4dab7e9d747dfa06245ec8a0)
---
Modified: src/modules/ctl/binrpc.h
---
Diff:
https://github.com/kamailio/kamailio/commit/29b6562d8ebe6277fda5524dda18b88…
Patch:
https://github.com/kamailio/kamailio/commit/29b6562d8ebe6277fda5524dda18b88…
---
diff --git a/src/modules/ctl/binrpc.h b/src/modules/ctl/binrpc.h
index fd247bc603a..7909bc930d4 100644
--- a/src/modules/ctl/binrpc.h
+++ b/src/modules/ctl/binrpc.h
@@ -719,10 +719,12 @@ inline static unsigned char *binrpc_read_record(struct
binrpc_parse_ctx *ctx,
*err = E_BINRPC_MORE_DATA;
goto error;
}
- if((v->type != type) && (v->type != BINRPC_T_ALL)) {
- goto error_type;
+ if(!(v->type == BINRPC_T_DOUBLE && type == BINRPC_T_INT)) {
+ if((v->type != type) && (v->type != BINRPC_T_ALL)) {
+ goto error_type;
+ }
+ v->type = type;
}
- v->type = type;
switch(type) {
case BINRPC_T_STRUCT:
if(ctx->in_struct) {
@@ -779,7 +781,12 @@ inline static unsigned char *binrpc_read_record(struct
binrpc_parse_ctx *ctx,
case BINRPC_T_INT:
if(ctx->in_struct && smode == 0)
goto error_record;
- p = binrpc_read_int(&v->u.intval, len, p, end, err);
+ if(v->type == BINRPC_T_DOUBLE) {
+ p = binrpc_read_int(&tmp, len, p, end, err);
+ v->u.fval = tmp;
+ } else {
+ p = binrpc_read_int(&v->u.intval, len, p, end, err);
+ }
break;
case BINRPC_T_STR:
if(ctx->in_struct && smode == 0)