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

Fix NULL-ptr dereferences when subscan is NULL

parent 5d7228eb
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1097 passed
...@@ -287,16 +287,16 @@ static JSBool js_sub_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp) ...@@ -287,16 +287,16 @@ static JSBool js_sub_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
*vp = JSVAL_FALSE; *vp = JSVAL_FALSE;
break; break;
case SUB_PROP_SCAN_PTR: case SUB_PROP_SCAN_PTR:
*vp=UINT_TO_JSVAL(scan->ptr); if(scan != NULL) *vp=UINT_TO_JSVAL(scan->ptr);
break; break;
case SUB_PROP_SCAN_CFG: case SUB_PROP_SCAN_CFG:
*vp=UINT_TO_JSVAL(scan->cfg); if(scan != NULL) *vp=UINT_TO_JSVAL(scan->cfg);
break; break;
case SUB_PROP_LAST_READ: case SUB_PROP_LAST_READ:
*vp=UINT_TO_JSVAL(scan->last); if(scan != NULL) *vp=UINT_TO_JSVAL(scan->last);
break; break;
case SUB_PROP_POSTS: case SUB_PROP_POSTS:
*vp=UINT_TO_JSVAL(getposts(p->cfg, p->subnum)); if(scan != NULL) *vp=UINT_TO_JSVAL(getposts(p->cfg, p->subnum));
break; break;
} }
...@@ -543,6 +543,7 @@ JSBool DLLCALL js_msg_area_resolve(JSContext* cx, JSObject* areaobj, jsid id) ...@@ -543,6 +543,7 @@ JSBool DLLCALL js_msg_area_resolve(JSContext* cx, JSObject* areaobj, jsid id)
if(np == NULL) if(np == NULL)
continue; continue;
*np = *p; *np = *p;
if(p->subscan != NULL)
np->subscan = &p->subscan[d]; np->subscan = &p->subscan[d];
np->subnum = d; np->subnum = d;
JS_SetPrivate(cx, subobj, np); JS_SetPrivate(cx, subobj, np);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment