net: lwm2m: Do not use snprintk() to get debugging token
net: lwm2m: Do not use snprintk() to get debugging token

It's highly unlikely that snprintk() will return a negative value, but
that's a possibility that will make the `pos` variable be set to a
value outside the boundaries of the statically allocated `buf` array.

Also clamp writes to ensure that the statically allocated buffer won't
be overwritten with a large token length.

Fixes #7070.

Signed-off-by: Leandro Pereira <51c7437a02b34df685e6b4ecb2e9bca23efe2e1a@intel.com>

finikorg/zephyr,kraj/zephyr,explora26/zephyr,finikorg/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,punitvara/zephyr,explora26/zephyr,explora26/zephyr,nashif/zephyr,galak/zephyr,nashif/zephyr,zephyriot/zephyr,punitvara/zephyr,ldts/zephyr,Vudentz/zephyr,galak/zephyr,Vudentz/zephyr,finikorg/zephyr,punitvara/zephyr,GiulianoFranchetto/zephyr,punitvara/zephyr,kraj/zephyr,GiulianoFranchetto/zephyr,finikorg/zephyr,mbolivar/zephyr,kraj/zephyr,zephyriot/zephyr,Vudentz/zephyr,mbolivar/zephyr,kraj/zephyr,galak/zephyr,Vudentz/zephyr,Vudentz/zephyr,zephyriot/zephyr,GiulianoFranchetto/zephyr,galak/zephyr,mbolivar/zephyr,explora26/zephyr,nashif/zephyr,nashif/zephyr,punitvara/zephyr,mbolivar/zephyr,ldts/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,GiulianoFranchetto/zephyr,zephyriot/zephyr,kraj/zephyr,ldts/zephyr,mbolivar/zephyr,ldts/zephyr,explora26/zephyr,GiulianoFranchetto/zephyr,zephyriot/zephyr,Vudentz/zephyr,ldts/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr