[sr-dev] git:master:2ea56a4c: cplc: manage case where TZ environment variable is not set.

Daniel-Constantin Mierla miconda at gmail.com
Thu Mar 3 16:10:23 CET 2022


Module: kamailio
Branch: master
Commit: 2ea56a4cf40045bb92b1f17f5a0b8c172da4f866
URL: https://github.com/kamailio/kamailio/commit/2ea56a4cf40045bb92b1f17f5a0b8c172da4f866

Author: frederic <frederic.gaisnon at mmtt.fr>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-03-03T16:10:17+01:00

cplc: manage case where TZ environment variable is not set.

---

Modified: src/modules/cplc/cpl_switches.h

---

Diff:  https://github.com/kamailio/kamailio/commit/2ea56a4cf40045bb92b1f17f5a0b8c172da4f866.diff
Patch: https://github.com/kamailio/kamailio/commit/2ea56a4cf40045bb92b1f17f5a0b8c172da4f866.patch

---

diff --git a/src/modules/cplc/cpl_switches.h b/src/modules/cplc/cpl_switches.h
index c3c8572f4c..e2d15bfbb3 100644
--- a/src/modules/cplc/cpl_switches.h
+++ b/src/modules/cplc/cpl_switches.h
@@ -815,7 +815,7 @@ static inline char *run_time_switch( struct cpl_interpreter *intr )
 				/* does the recv_time match the specified interval?  */
 				j = cpl_check_tmrec( &trt, &att, 0);
 				/* restore the orig TZ */
-				if ( flags&(1<<7) )
+                                if ((flags&(1<<7)) && cpl_env.orig_tz.s && (cpl_env.orig_tz.len > 3))
 					set_TZ(cpl_env.orig_tz.s);
 				/* reset flags */
 				flags &= (1<<7);
@@ -850,7 +850,7 @@ static inline char *run_time_switch( struct cpl_interpreter *intr )
 	cpl_tmrec_free( &trt );
 	return DEFAULT_ACTION;
 runtime_error:
-	if ( flags&(1<<7) )
+        if ((flags&(1<<7)) && cpl_env.orig_tz.s && (cpl_env.orig_tz.len > 3))
 		set_TZ(cpl_env.orig_tz.s);
 	cpl_ac_tm_free( &att );
 	cpl_tmrec_free( &trt );
@@ -859,7 +859,7 @@ static inline char *run_time_switch( struct cpl_interpreter *intr )
 	LM_ERR("error parsing attr [%d][%s]\n",
 		attr_name,attr_str?(char*)attr_str:"NULL");
 script_error:
-	if ( flags&(1<<7) )
+        if ((flags&(1<<7)) && cpl_env.orig_tz.s && (cpl_env.orig_tz.len > 3))
 		set_TZ(cpl_env.orig_tz.s);
 	cpl_ac_tm_free( &att );
 	cpl_tmrec_free( &trt );




More information about the sr-dev mailing list