From 0518048263cc2a0a638e6924d164d7a00b934240 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Mon, 16 Jun 2014 10:57:43 +0300 Subject: [PATCH] HDP: Add length check Fixes static analyzer warnings related to casting possible error code to unsigned. --- profiles/health/hdp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c index d256c9f09..4f90380f9 100644 --- a/profiles/health/hdp.c +++ b/profiles/health/hdp.c @@ -863,7 +863,10 @@ static gboolean serve_echo(GIOChannel *io_chan, GIOCondition cond, chan->edata->echo_done = TRUE; fd = g_io_channel_unix_get_fd(io_chan); + len = read(fd, buf, sizeof(buf)); + if (len < 0) + goto fail; if (send_echo_data(fd, buf, len) >= 0) return TRUE; -- 2.47.3