Commit d5ccd1e1 authored by deuce's avatar deuce
Browse files

Fix resolve functions in CPP

parent ddb2af61
...@@ -281,7 +281,7 @@ bool sbbs_t::checkfname(char *fname) ...@@ -281,7 +281,7 @@ bool sbbs_t::checkfname(char *fname)
if(fname[0]=='-' if(fname[0]=='-'
|| strcspn(fname,ILLEGAL_FILENAME_CHARS)!=strlen(fname)) { || strcspn(fname,ILLEGAL_FILENAME_CHARS)!=strlen(fname)) {
lprintf(LOG_WARNING,"Suspicious filename attempt: '%s'",fname); lprintf(LOG_WARNING,"Suspicious filename attempt: '%s'",fname);
hacklog("Filename", fname); hacklog((char *)"Filename", fname);
return(false); return(false);
} }
if(strstr(fname,"..")) if(strstr(fname,".."))
......
...@@ -3481,15 +3481,19 @@ static JSBool js_bbs_resolve(JSContext *cx, JSObject *obj, jsid id) ...@@ -3481,15 +3481,19 @@ static JSBool js_bbs_resolve(JSContext *cx, JSObject *obj, jsid id)
{ {
char* name=NULL; char* name=NULL;
if(id != JSVAL_NULL) if(id != JSID_VOID && id != JSID_EMPTY) {
name=JS_GetStringBytes(JSVAL_TO_STRING(id)); jsval idval;
JS_IdToValue(cx, id, &idval);
name=JS_GetStringBytes(JSVAL_TO_STRING(idval));
}
return(js_SyncResolve(cx, obj, name, js_bbs_properties, js_bbs_functions, NULL, 0)); return(js_SyncResolve(cx, obj, name, js_bbs_properties, js_bbs_functions, NULL, 0));
} }
static JSBool js_bbs_enumerate(JSContext *cx, JSObject *obj) static JSBool js_bbs_enumerate(JSContext *cx, JSObject *obj)
{ {
return(js_bbs_resolve(cx, obj, JSVAL_NULL)); return(js_bbs_resolve(cx, obj, JSID_VOID));
} }
static JSClass js_bbs_class = { static JSClass js_bbs_class = {
......
...@@ -1762,15 +1762,19 @@ static JSBool js_console_resolve(JSContext *cx, JSObject *obj, jsid id) ...@@ -1762,15 +1762,19 @@ static JSBool js_console_resolve(JSContext *cx, JSObject *obj, jsid id)
{ {
char* name=NULL; char* name=NULL;
if(id != JSVAL_NULL) if(id != JSID_VOID && id != JSID_EMPTY) {
name=JS_GetStringBytes(JSVAL_TO_STRING(id)); jsval idval;
JS_IdToValue(cx, id, &idval);
name=JS_GetStringBytes(JSVAL_TO_STRING(idval));
}
return(js_SyncResolve(cx, obj, name, js_console_properties, js_console_functions, NULL, 0)); return(js_SyncResolve(cx, obj, name, js_console_properties, js_console_functions, NULL, 0));
} }
static JSBool js_console_enumerate(JSContext *cx, JSObject *obj) static JSBool js_console_enumerate(JSContext *cx, JSObject *obj)
{ {
return(js_console_resolve(cx, obj, JSVAL_NULL)); return(js_console_resolve(cx, obj, JSID_VOID));
} }
static JSClass js_console_class = { static JSClass js_console_class = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment