Module: kamailio Branch: master Commit: 1380a4a0d18159c7130b70c0216134a253ad83f7 URL: https://github.com/kamailio/kamailio/commit/1380a4a0d18159c7130b70c0216134a2...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-03-18T08:16:44+01:00
ctl: handle int input for double storage
---
Modified: src/modules/ctl/binrpc.h
---
Diff: https://github.com/kamailio/kamailio/commit/1380a4a0d18159c7130b70c0216134a2... Patch: https://github.com/kamailio/kamailio/commit/1380a4a0d18159c7130b70c0216134a2...
---
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)