-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
MAJORNot critical, but also important to fix ASAPNot critical, but also important to fix ASAP
Description
Major: Potential NULL Dereference in cleanup_old_requests
Priority: MAJOR
Type: Memory Safety
Location
libwsv5.c line 940 in cleanup_old_requests()
Issue
Code accesses old->response fields without checking if response is NULL:
if (now - (*req)->timestamp > 30) {
pending_request_t *old = *req;
*req = old->next;
pthread_mutex_lock(&old->mutex);
old->completed = true;
old->response->success = false; // ← NULL dereference if response is NULL!
old->response->error_message = strdup("Request timeout");
pthread_cond_broadcast(&old->cond);
pthread_mutex_unlock(&old->mutex);
}Impact
Race condition scenario:
obsws_send_request()transfers ownership:req->response = NULLcleanup_old_requests()runs concurrently- Tries to access
old->response->success→ NULL pointer dereference → crash
Additional Note
The current design has a subtle issue: after timeout cleanup, the response object might be partially populated. Consider whether timed-out requests should have their response freed entirely or kept with error flag.
Metadata
Metadata
Assignees
Labels
MAJORNot critical, but also important to fix ASAPNot critical, but also important to fix ASAP