Module: kamailio Branch: 5.8 Commit: 90f8117f9669069b4dab7e9d747dfa06245ec8a0 URL: https://github.com/kamailio/kamailio/commit/90f8117f9669069b4dab7e9d747dfa06...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-03-19T18:20:18+01:00
ctl: handle int input for double storage
(cherry picked from commit 1380a4a0d18159c7130b70c0216134a253ad83f7)
---
Modified: src/modules/ctl/binrpc.h
---
Diff: https://github.com/kamailio/kamailio/commit/90f8117f9669069b4dab7e9d747dfa06... Patch: https://github.com/kamailio/kamailio/commit/90f8117f9669069b4dab7e9d747dfa06...
---
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)