[Openais] Fix for crash when environment variable list is empty

Ola Lundqvist ola.lundqvist at tietoenator.com
Sun Sep 3 23:45:42 PDT 2006


Hi

The following patch fix a problem that I had. aisexec crashed
unexpectedly when starting up. I found that I had set no environment
variables to be sent to the component. I assume that is a valid case so
here is the fix.

It is simply a check if component->saAmfCompCmdEnv is NULL and if so, do
not loop around it.

--- exec/amfcomp.c      (revision 1235)
+++ exec/amfcomp.c      (working copy)
@@ -1854,14 +1854,16 @@
                buf, &size, &offset, component->saAmfCompNumMaxStandbyCsi);

        /* count environment vars and write to buf */
-       for (i = 0; component->saAmfCompCmdEnv[i] != NULL; i++);
+        if (component->saAmfCompCmdEnv != NULL) {
+            for (i = 0; component->saAmfCompCmdEnv[i] != NULL; i++);
+        }
        buf = amf_serialize_SaUint32T (buf, &size, &offset, i);
-
-       for (i = 0; component->saAmfCompCmdEnv[i] != NULL; i++) {
+        if (component->saAmfCompCmdEnv != NULL) {
+            for (i = 0; component->saAmfCompCmdEnv[i] != NULL; i++) {
                buf = amf_serialize_SaStringT (
-                       buf, &size, &offset, component->saAmfCompCmdEnv[i]);
-       }
-
+                    buf, &size, &offset, component->saAmfCompCmdEnv[i]);
+            }
+        }
        buf = amf_serialize_SaUint32T (
                buf, &size, &offset,
component->saAmfCompDefaultClcCliTimeout);
        buf = amf_serialize_SaUint32T (

Best regards,

// Ola

-- 
 Ola Lundqvist, Civilingenjör Informationsteknologi
 TietoEnator R&D Services AB, Telecom Platforms
 Email:  ola.lundqvist at tietoenator.com
 Phone:  +46 (0)54-29 42 17



More information about the Openais mailing list