r8253: fixed two crash bugs in ejs. I will send these fixes off to the appweb guys...
authorAndrew Tridgell <tridge@samba.org>
Sat, 9 Jul 2005 05:23:47 +0000 (05:23 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:19:26 +0000 (13:19 -0500)
(This used to be commit 3fe83b48c3fe4cdc1e7ec0271e08f7bd77e90de9)

source4/lib/ejs/ejsParser.c
source4/lib/ejs/var.c

index 57cb569cdb1c4a8c182fb20f2b629994b8b248ce..72b0889c558ce0f66bad7465fbcd0560cd2d6491 100644 (file)
@@ -1555,6 +1555,7 @@ static int evalExpr(Ejs *ep, MprVar *lhs, int rel, MprVar *rhs)
                if (lhs->type == MPR_TYPE_STRING) {
                        if (isdigit((int) lhs->string[0])) {
                                num = mprVarToNumber(lhs);
+                               lhs->allocatedVar = 0;
                                mprDestroyVar(lhs);
                                *lhs = mprCreateNumberVar(num);
                                /* Examine further below */
@@ -1564,6 +1565,7 @@ static int evalExpr(Ejs *ep, MprVar *lhs, int rel, MprVar *rhs)
                                 *      Convert the RHS to a string
                                 */
                                mprVarToString(&str, MPR_MAX_STRING, 0, rhs);
+                               rhs->allocatedVar = 0;
                                mprDestroyVar(rhs);
                                *rhs = mprCreateStringVar(str, 1);
                                mprFree(str);
index 6ef1c4d3a381d4bb1fbe314050fd98fddbd19b62..63c0b7b98d0a9a023af8d468323aa60e1d8e6c30 100644 (file)
@@ -602,7 +602,8 @@ MprVar *mprGetProperty(MprVar *obj, const char *property, MprVar *value)
 
        for (prop = getObjChain(obj->properties, property); prop; 
                        prop = prop->forw) {
-               if (prop->name[0] == property[0] && strcmp(prop->name, property) == 0) {
+               if (prop->name && 
+                       prop->name[0] == property[0] && strcmp(prop->name, property) == 0) {
                        break;
                }
        }