diff mbox

[03/13] libmultipath: fixup strlcpy

Message ID 1384511384-27642-4-git-send-email-hare@suse.de (mailing list archive)
State Accepted, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Hannes Reinecke Nov. 15, 2013, 10:29 a.m. UTC
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 mbox

Patch

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;
 }