Security Vulnerability: NULL Pointer Dereference (Medium)
Description
In handleFaupCommand, strtok(NULL, "\t") can return NULL when a client sends a field name without a corresponding value. The NULL pointer is then passed to atof(), which is undefined behavior and typically causes a segfault/crash.
Location
net_io.c:1138-1175
Vulnerable Code
msg_field = strtok(p, "\t");
while (msg_field != NULL) {
if (!strcmp(msg_field, "upload_rate_multiplier")) {
msg_field = strtok(NULL, "\t");
multiplier = atof(msg_field); // msg_field could be NULL!
Attack Vector
A client connected to the FAUP command port sends:
(with a tab but no value). strtok returns NULL, atof(NULL) crashes.
Same issue exists for upload_unknown_commb at line 1166.
Impact
- Denial of service via crash
- Any connected client can trigger this
Suggested Fix
Check msg_field != NULL after each strtok(NULL, ...) call:
msg_field = strtok(NULL, "\t");
if (msg_field == NULL)
break;
multiplier = atof(msg_field);
Security Vulnerability: NULL Pointer Dereference (Medium)
Description
In
handleFaupCommand,strtok(NULL, "\t")can return NULL when a client sends a field name without a corresponding value. The NULL pointer is then passed toatof(), which is undefined behavior and typically causes a segfault/crash.Location
net_io.c:1138-1175Vulnerable Code
Attack Vector
A client connected to the FAUP command port sends:
(with a tab but no value).
strtokreturns NULL,atof(NULL)crashes.Same issue exists for
upload_unknown_commbat line 1166.Impact
Suggested Fix
Check
msg_field != NULLafter eachstrtok(NULL, ...)call: