wakaama
wakaama copied to clipboard
LwM2M Client Name limit in a custom LwM2M server
Description
When compiling our custom LwM2M server based on **wakaama/core/liblwm2m.h" with -O2 optimization level, LwM2M Client Names are limited to 11 characters, compiling the same code without any optimizations avoids this problem. This was tested with wakaama lwm2mclient example.
Possible solution
Adding volatile keyword to size_t option_len in wakaama/core/er-coap-13/er-coap-13.c:257 fixes the problem.
-- coap_add_multi_option(multi_option_t **dst, uint8_t *option, size_t option_len, uint8_t is_static)
++ coap_add_multi_option(multi_option_t **dst, uint8_t *option, volatile size_t option_len, uint8_t is_static)
I am using 9865bd30910a7d3d4c1a3dbd1546e7ab3886f152 commit of wakaama with a few changes (I know it is very old), but as far as I see neither the changes nor the outdated commit should cause this behaviour. I haven't checked if other functions need the keyword volatile. Could anyone else try to replicate this problem?
@sbertin-telular, what do you think about this ?
I can confirm that the problem exists, but I have not identified the cause.