Skip to content
Snippets Groups Projects
Commit 6d9a2728 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Throw an exception in bbs.exec_xtrn() when passed no argument

... or when passed an invalid external program code or number, rather just just returning false. The underlying exec_xtrn() C++ function may return false (failure) for other reasons, so let's not obfuscate the other potential failure causes.
parent b4fbc321
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #899 passed
......@@ -1351,7 +1351,9 @@ js_exec_xtrn(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist, JSVAL_VOID);
if(argc) {
if(!js_argc(cx, argc, 1))
return JS_FALSE;
if(JSVAL_IS_STRING(argv[0])) {
JSVALUE_TO_ASTRING(cx,argv[0],code, LEN_CODE+2, NULL);
if(code==NULL)
......@@ -1364,11 +1366,10 @@ js_exec_xtrn(JSContext *cx, uintN argc, jsval *arglist)
if(!JS_ValueToECMAUint32(cx,argv[0],&i))
return JS_FALSE;
}
}
if(i>=sbbs->cfg.total_xtrns) {
JS_SET_RVAL(cx, arglist, JSVAL_FALSE);
return(JS_TRUE);
JS_ReportError(cx, "Invalid external program specified");
return JS_FALSE;
}
rc=JS_SUSPENDREQUEST(cx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment