Check for missing program name when accepting a streaming connection (#22520)
* Normalize `prog_name` and `prog_version` to "unknown" when missing in streaming children * Fix comment Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Stelios Fragkakis committed
May 22, 2026 at 10:10 UTC
239e7e8d7199dc60d76a0cdd4a56128e788d5d29
1 file changed
+6
src/database/rrdhost.c
+6
@@ -540,6 +540,12 @@ static void rrdhost_update(RRDHOST *host
540
{
541
UNUSED(guid);
542
543
+ // Streaming children may omit the User-Agent header, leaving prog_name/prog_version NULL.
544
+ // Match the defaults assigned on the host create path (for example in set_host_properties()/rrdhost_create())
545
+ // so the strcmp/string_strdupz calls below are safe.
546
+ if(!prog_name || !*prog_name) prog_name = "unknown";
547
+ if(!prog_version || !*prog_version) prog_version = "unknown";
548
+
549
spinlock_lock(&host->rrdhost_update_lock);
550
551
host->health.enabled = (mode == RRD_DB_MODE_NONE) ? 0 : health;