Update of /usr/cvsroot/asterisk/funcs
In directory mongoose.digium.com:/tmp/cvs-serv31548/funcs

Modified Files:
        func_logic.c 
Log Message:
prevent copying of NULL (bug #4307)


Index: func_logic.c
===================================================================
RCS file: /usr/cvsroot/asterisk/funcs/func_logic.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- func_logic.c        5 May 2005 12:48:52 -0000       1.2
+++ func_logic.c        17 May 2005 16:45:42 -0000      1.3
@@ -52,12 +52,14 @@
                                *iffalse = '\0';
                                iffalse++;
                        }
-               } else 
-                       iffalse = "";
+               } 
+
                if (expr && iftrue) {
                        ret = ast_true(expr) ? iftrue : iffalse;
-                       strncpy(buf, ret, len);
-                       ret = buf;
+                       if (ret) {
+                               ast_copy_string(buf, ret, len);
+                               ret = buf;
+                       }
                } else {
                        ast_log(LOG_WARNING, "Syntax $(if 
<expr>?[<truecond>][:<falsecond>])\n");
                        ret = NULL;

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to