[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH 03/13] libmultipath: fixup strlcpy



The final comparison was wrong; 'size' was never decreased.

Signed-off-by: Hannes Reinecke <hare suse de>
---
 libmultipath/util.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libmultipath/util.c b/libmultipath/util.c
index 41ac21b..a9f5939 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -112,8 +112,7 @@ size_t strlcpy(char *dst, const char *src, size_t size)
 		bytes++;
 	}
 
-	/* If size == 0 there is no space for a final null... */
-	if (size)
+	if (bytes == size)
 		*q = '\0';
 	return bytes;
 }
-- 
1.8.1.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]