SIGN IN SIGN UP
fatedier / frp UNCLAIMED

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.

0 0 71 Go

pkg/util/xlog: fix AddPrefix not updating existing prefix due to range value copy (#5206)

In AddPrefix, the loop `for _, p := range l.prefixes` creates a copy
of each element. Assignments to p.Value and p.Priority only modify
the local copy, not the original slice element, causing updates to
existing prefixes to be silently lost.

This affects client/service.go where AddPrefix is called with
Name:"runID" on reconnection — the old runID value would persist
in log output instead of being updated to the new one.

Fix by using index-based access `l.prefixes[i]` to modify the
original slice element, and add break since prefix names are unique.
F
fatedier committed
f2d1f3739ad06e38e77ab77c162cbc9b871ca2d4
Parent: c23894f
Committed by GitHub <noreply@github.com> on 3/6/2026, 12:44:40 PM