From 514731b0ee7d8f9c79cbc88672a7957b7ba1eacd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 9 Jul 2005 05:23:47 +0000 Subject: r8253: fixed two crash bugs in ejs. I will send these fixes off to the appweb guys soon. (This used to be commit 3fe83b48c3fe4cdc1e7ec0271e08f7bd77e90de9) --- source4/lib/ejs/ejsParser.c | 2 ++ source4/lib/ejs/var.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/lib/ejs/ejsParser.c b/source4/lib/ejs/ejsParser.c index 57cb569cdb..72b0889c55 100644 --- a/source4/lib/ejs/ejsParser.c +++ b/source4/lib/ejs/ejsParser.c @@ -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); diff --git a/source4/lib/ejs/var.c b/source4/lib/ejs/var.c index 6ef1c4d3a3..63c0b7b98d 100644 --- a/source4/lib/ejs/var.c +++ b/source4/lib/ejs/var.c @@ -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; } } -- cgit