#### Type Of Change
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [X ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
This fixes mtree to be able to contain strings with character
values larger than 0x80. Previously this would not work because
the str.s[i] is 'char' and when cast to 'unsigned int' it would
be first sign extended for maximum range (on systems where 'char'
defaults to signed). E.g. on x86_64 system:
(unsigned int)(char)0x80 = 4294967168
The >=MT_CHAR_TABLE_SIZE test would filter any string containing
these characters out as invalid.
Code is fixed to cast _mt_char_table index to 'unsigned char'
always so index is within range always. The new redundant checks
against MT_CHAR_TABLE_SIZE are removed, and the result is stored
to local variable (and used from it) to improve code readability.
The error message in mt_add_to_tree() is harmonized with the other
messages to show the full string with a problem.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1343
-- Commit Summary --
* mtree: fix handling of character values >= 0x80
-- File Changes --
M src/modules/mtree/mtree.c (132)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1343.patch
https://github.com/kamailio/kamailio/pull/1343.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1343