Fix SonarCloud security hotspots and cgroup-network namespace handling (#22460)
* fix(json): replace unsafe sprintf with snprintfz and buffer_print_netdata_double Fix SonarCloud c:S6069 findings: - Line 106: sprintf → snprintfz for ARRAY formatting into 50-byte buffer - Line 115: Replace intermediate buffer + sprintf with buffer_print_netdata_double() which writes directly to BUFFER* and handles NaN/Inf correctly (outputs null) Security: Prevents buffer overflow with large double values (e.g., 1e308 produces 300+ chars with %f format). * fix(api): replace unsafe sprintf with snprintfz for plugin:module name Fix SonarCloud c:S6069 finding at line 18. Plugin and module names (STRING* type) have no enforced maximum length. Use snprintfz to prevent buffer overflow in the 500-byte name buffer. Security: Prevents potential buffer overflow from malicious or misconfigured collectors with long plugin/module names. * fix(cgroup-network): harden namespace switching and chroot security This commit addresses multiple security and correctness issues in the cgroup-network collector's namespace switching logic: 1. **Fix chroot escape vulnerability (CWE-243)** Added chdir("/") after successful chroot to ensure the working directory is inside the chroot jail, preventing potential escapes. 2. **Fix silent failures in namespace switching** The function previously logged errors for fchdir(), chroot(), and chdir() failures but continued execution and returned success. Now all critical filesystem operations return failure (1) on error, properly closing file descriptors. 3. **Fix overly strict namespace verification** The verification loop required ALL namespaces to succeed, causing false failures for containers with shared PID namespaces (--pid=host) or mount namespaces. Now only CLONE_NEWNET is mandatory. - CLONE_NEWNET failure: returns error (cannot detect interfaces) - CLONE_NEWNS/CLONE_NEWPID failure: logs warning, continues 4. **Proper cleanup on all error paths** All failure paths now close root_fd, cwd_fd, and namespace fds before returning. Security impact: Closes CWE-243, prevents reading host network interfaces as container data when namespace switching fails. Fixes SonarCloud hotspot c:S5802. * sow work * cgroup-network: fix chroot escape, namespace error handling, and fd cleanup * sonar-mark.sh: document family-ack in usage header * cgroup-network: use appropriate log level for optional namespace open failures * cgroup-network: fix ND_LOG_FIELD_PRIORITY type name * cgroup-network: remove unused cwd_fd variable and open * cgroup-network: remove dead assignment to root_fd after close