Module: kamailio Branch: master Commit: 82c786fde7a635738c905899fb6edc9b7d1a2b67 URL: https://github.com/kamailio/kamailio/commit/82c786fde7a635738c905899fb6edc9b...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-07-31T07:41:43+02:00
corex: functions to manage iflags can get 0..63 parameter value
---
Modified: src/modules/corex/corex_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/82c786fde7a635738c905899fb6edc9b... Patch: https://github.com/kamailio/kamailio/commit/82c786fde7a635738c905899fb6edc9b...
---
diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c index e853032cd7f..de2fb03b5fd 100644 --- a/src/modules/corex/corex_mod.c +++ b/src/modules/corex/corex_mod.c @@ -587,6 +587,7 @@ static msg_iflag_name_t _msg_iflag_list[] = { static unsigned long long msg_lookup_flag(str *fname) { int i; + for(i = 0; _msg_iflag_list[i].name.len > 0; i++) { if(fname->len == _msg_iflag_list[i].name.len && strncasecmp(_msg_iflag_list[i].name.s, fname->s, fname->len) @@ -594,7 +595,22 @@ static unsigned long long msg_lookup_flag(str *fname) return _msg_iflag_list[i].value; } } - return 0; + if(fname->len < 1 || fname->len > 2) { + return 0; + } + if(!(fname->s[0] >= '0' && fname->s[0] <= '9')) { + return 0; + } + if(fname->len == 1) { + return 1ULL << (fname->s[0] - '0'); + } + if(!(fname->s[1] >= '0' && fname->s[1] <= '9')) { + return 0; + } + if((10 * (fname->s[0] - '0') - (fname->s[1] - '0')) > 63) { + return 0; + } + return 1ULL << (10 * (fname->s[0] - '0') - (fname->s[1] - '0')); }
/**