From 4ebb3c1bb617e914393cced79f1a617308c7520c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Nov 2013 18:54:22 +0100 Subject: [PATCH] network: Fix CID 113095 - unchecked return value from library Check return of "recv" in readline(). Found by coverity. Signed-off-by: Michael Adam (cherry picked from commit 49c55ed26c877a435ad081d98ba99294ac76262d) --- src/network.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/network.c b/src/network.c index 61dcbae..9caef04 100644 --- a/src/network.c +++ b/src/network.c @@ -191,7 +191,11 @@ ssize_t readline (int fd, char **whole_buffer) goto CLEANUP; } - recv (fd, line_ptr->data, diff, 0); + ret = recv (fd, line_ptr->data, diff, 0); + if (ret == -1) { + goto CLEANUP; + } + line_ptr->len = diff; if (ptr) {