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

Fix a couple of potential NULL-pointer deferences in js_initcx() failure cases

service_client->client is NULL in these failure/error cases, so get the
protocol string from the service_client->service (which is not NULL) instead.
parent 9058bc1b
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -788,7 +788,7 @@ js_initcx(JSRuntime* js_runtime, SOCKET sock, service_client_t* service_client,
BOOL rooted=FALSE;
if((js_cx = JS_NewContext(js_runtime, JAVASCRIPT_CONTEXT_STACK))==NULL) {
lprintf(LOG_CRIT, "%04d %s JavaScript: Failed to create new context", sock, service_client->client->protocol);
lprintf(LOG_CRIT, "%04d %s JavaScript: Failed to create new context", sock, service_client->service->protocol);
return(NULL);
}
JS_SetOptions(js_cx, startup->js.options);
......@@ -898,7 +898,7 @@ js_initcx(JSRuntime* js_runtime, SOCKET sock, service_client_t* service_client,
if(!success) {
lprintf(LOG_CRIT, "%04d %s JavaScript: Failed to create global objects and classes"
,sock, service_client->client->protocol);
,sock, service_client->service->protocol);
if(rooted)
JS_RemoveObjectRoot(js_cx, glob);
JS_ENDREQUEST(js_cx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment