summaryrefslogtreecommitdiff
path: root/profiles/health
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2014-06-16 10:57:43 +0300
committerSzymon Janc <szymon.janc@gmail.com>2014-06-18 00:05:40 +0200
commit0518048263cc2a0a638e6924d164d7a00b934240 (patch)
tree359b5178fe917d6dc9ab7e01395d58a20635a1c4 /profiles/health
parent5050a95c01b20e409153d7de0da649e43b5239f3 (diff)
downloadbluez-0518048263cc2a0a638e6924d164d7a00b934240.tar.gz
HDP: Add length check
Fixes static analyzer warnings related to casting possible error code to unsigned.
Diffstat (limited to 'profiles/health')
-rw-r--r--profiles/health/hdp.c3
1 files changed, 3 insertions, 0 deletions
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;