service: prevent nil deref in validate with wrapped join request (#4547)
When a client hits /rtc/v[01]/validate with a base64 WrappedJoinRequest whose embedded JoinRequest.ClientInfo is unset, validateInternal called AugmentClientInfo with a nil *ClientInfo and panicked at ci.Address = GetClientIP(req). The non-wrapped branch already allocates via ParseClientInfo; do the same here so pi.Client always gets at least the resolved client Address.
This commit is contained in:
@@ -254,6 +254,9 @@ func (s *RTCService) validateInternal(
|
|||||||
} else {
|
} else {
|
||||||
lgr.Debugw("processing join request", "joinRequest", logger.Proto(joinRequest))
|
lgr.Debugw("processing join request", "joinRequest", logger.Proto(joinRequest))
|
||||||
|
|
||||||
|
if joinRequest.ClientInfo == nil {
|
||||||
|
joinRequest.ClientInfo = &livekit.ClientInfo{}
|
||||||
|
}
|
||||||
AugmentClientInfo(joinRequest.ClientInfo, r)
|
AugmentClientInfo(joinRequest.ClientInfo, r)
|
||||||
pi.Client = joinRequest.ClientInfo
|
pi.Client = joinRequest.ClientInfo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user