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

Fix null pointer deref (crash) in new_user() when "client" object is invalid

When system.new_user() was called but the current "client" object is uninitialized (e.g. has NULL protocol, host or IP address fields because there is no active client, e.g. because is was called from a timed event with active user online) - this code would dereference a NULL pointer and crash the b0rad. Reported by Mortifis.
parent 363388eb
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #938 passed
...@@ -1701,9 +1701,12 @@ js_new_user(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1701,9 +1701,12 @@ js_new_user(JSContext *cx, uintN argc, jsval *arglist)
} }
} }
if(client!=NULL) { if(client!=NULL) {
SAFECOPY(user.modem,client->protocol); if(client->protocol != NULL)
SAFECOPY(user.comp,client->host); SAFECOPY(user.modem,client->protocol);
SAFECOPY(user.ipaddr,client->addr); if(client->host != NULL)
SAFECOPY(user.comp,client->host);
if(client->addr != NULL)
SAFECOPY(user.ipaddr,client->addr);
} }
user.sex=' '; user.sex=' ';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment