You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: harden ebpf snprintf handling
Fix incorrect snprintf/vsnprintf return-value semantics in eBPF user-space code.
Add safe_snprintf/safe_vsnprintf helpers that consistently return the actual written length, and avoid treating snprintf's intended output length as the actual written length when it is later used for:
- offset accumulation
- remaining buffer size calculation
- send length propagation
Also fix the affected paths in:
- log message assembly
- Java symbol collection and log sending
- stringifier string assembly
- socket datadump/http2/grpc/io-event formatting
- agent so path construction under target namespaces
Also fix one case where a dynamic string was used directly as a format string.
* test: add safe snprintf regression coverage
Add a focused eBPF test that compares snprintf and safe_snprintf for exact-fit, truncation, and offset-accumulation cases.
Also fix the socket datadump branch structure around safe_snprintf usage so the remaining-length calculation and write stay in the same conditional branch.
* fix: finish ebpf snprintf follow-up
Switch the remaining stack-trace string assembly in profile_common.c
from offset-based snprintf accumulation to safe_snprintf, and avoid
using map_name directly as a format string in tracer.c.
Also include the current ebpf test Makefile updates in this follow-up.
Conflicts:
agent/src/ebpf/test/Makefile
0 commit comments