From 01eb2edd6e59f3c5c1958ddd7d336d1e62f3b59e Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 28 May 2025 16:03:31 +0900 Subject: [PATCH] fixed nil pointer access in wpx api call --- server-ctl.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server-ctl.go b/server-ctl.go index 627e2c2..3f0927b 100644 --- a/server-ctl.go +++ b/server-ctl.go @@ -495,9 +495,13 @@ func (ctl *server_ctl_server_conns_id_routes_id) ServeHTTP(w http.ResponseWriter switch req.Method { case http.MethodGet: + var cts_id ConnId status_code = WriteJsonRespHeader(w, http.StatusOK) + // proxy_info_to_server_route() created the fake route but the function + // doesn't fake the Cts field and leaves it to nil. + if r.Cts == nil { cts_id = 0 } else { cts_id = r.Cts.Id } err = je.Encode(json_out_server_route{ - CId: r.Cts.Id, + CId: cts_id, RId: r.Id, ClientPeerAddr: r.PtcAddr, ClientPeerName: r.PtcName,