From dd66c5f337057e6d59f955f50d8b8efccec59733 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Thu, 7 Jan 2016 22:20:21 +0100
Subject: [PATCH] lib-sieve: util: realpath: Make Coverity happier.

---
 src/lib-sieve/util/realpath.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lib-sieve/util/realpath.c b/src/lib-sieve/util/realpath.c
index dfb562cd2..a8cfdc2b9 100644
--- a/src/lib-sieve/util/realpath.c
+++ b/src/lib-sieve/util/realpath.c
@@ -144,8 +144,11 @@ static int path_normalize(const char *path, bool resolve_links,
 					/* attempt to read the link */
 					if ((ret=readlink(npath, npath_link, lsize)) < 0)
 						return -1;
-					if ((size_t)ret < lsize)
+					if ((size_t)ret < lsize) {
+						/* make static analyzers happy */
+						npath_link[ret] = '\0';
 						break;
+					}
 
 					/* sum of new symlink content length and path tail length may not
 					   exeed maximum */
-- 
GitLab