### Description
With the latest master, I am trying to register UE in the IMS core. In the S-CSCF Diameter MAR message Authentication scheme is sent as 'unknown". With Kamailio 5.5.1 works fine. What I see the problem appears because of the following commits: 6eb67eaa4fc27d1eb7da7b2b674ffe8e7f86ecbc pv: handle case when var value ha flag str but null pointer ffe311939ebf58e7418940ec6c71bfaf9b21afad pv: fix condition in detecting the null string value when setting $var(...) - issue introduced in previous commit
Check the log messages below for detailed debug data. pv $aa is empty but after line 711 $var(alg) is with len=1 and printed value '0'.
#### Reproduction Try to Register UE to the IMS core with the latest master. Check MAR message AVP 612->avp 608 3GPP-SIP-Authentication-Scheme: unknown
#### Log Messages
In s-cscf kamailio.cfg route[REGISTER] I have the following code: 709 route[REGISTER] { 710 xlog("ALGORITHM IS [$aa] and User-Agent is [$ua]\n"); 711 $var(alg) = $aa; 712 xlog("ALGORITHM IS [$var(alg)] and User-Agent is [$ua]\n");
733 #user has not been authenticated. Lets send a challenge via 401 Unauthorized 734 xlog("L_DBG","About to challenge! auth_ims\n"); 735 ims_www_challenge("REG_MAR_REPLY", "$td", "$var(alg)"); 736 exit;
**LOG from master branch:** Log output for lines 710 and 712: Nov 11 14:50:30 kamailio_scscf[31798]: 1(31851) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=710 a=25 n=xlog Nov 11 14:50:30 kamailio_scscf[31798]: 1(31851) ERROR: <script>: ALGORITHM IS [] and User-Agent is [EE VOLTE] Nov 11 14:50:30 kamailio_scscf[31798]: 1(31851) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=711 a=63 n=assign Nov 11 14:50:30 kamailio_scscf[31798]: 1(31851) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=712 a=25 n=xlog Nov 11 14:50:30 kamailio_scscf[31798]: 1(31851) ERROR: <script>: ALGORITHM IS [0] and User-Agent is [EE VOLTE]
Added and debug log into authorize.c:356 file: ... LM_DBG(" #################### Sending MAR - 0, algo.len=%d algo[%.*s]\n", algo.len, algo.len, algo.s); .... Log output: Nov 11 14:50:30 kamailio_scscf[31798]: 1(31851) DEBUG: ims_auth [authorize.c:356]: challenge(): #################### Sending MAR - 0, algo.len=1 algo[0]
**LOG from Kamailio 5.5.1:** 117528 Nov 11 14:43:53 kamailio_scscf[19016]: 1(19060) ERROR: <script>: ALGORITHM IS [] and User-Agent is [EE VOLTE] 117529 Nov 11 14:43:53 kamailio_scscf[19016]: 1(19060) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=711 a=63 n=assign 117530 Nov 11 14:43:53 kamailio_scscf[19016]: 1(19060) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=712 a=25 n=xlog 117531 Nov 11 14:43:53 kamailio_scscf[19016]: 1(19060) ERROR: <script>: ALGORITHM IS [] and User-Agent is [EE VOLTE]
Nov 11 14:43:53 mnc234 kamailio_scscf[19016]: 1(19060) DEBUG: ims_auth [authorize.c:356]: challenge(): #################### Sending MAR - 0, algo.len=0 algo[]]
#### SIP Traffic
### Possible Solutions
<!-- If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix. -->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
version: kamailio 5.6.0-dev2 (x86_64/linux) ffe311-dirty flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: ffe311 -dirty compiled on 14:44:53 Nov 11 2021 with gcc 7.4.0
* **Operating System**:
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"