Skip to contentSkip to conversation

master - dmfilemapd: keep 1 byte for \0

PATCH Zdenek Kabelac 1 participant 1 message Apr 12, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dfc083d8d66cf3286908e9c7fc0c53bd1e5d4967
Commit:        dfc083d8d66cf3286908e9c7fc0c53bd1e5d4967
Parent:        6c342abb7f4fd13126467f6ab2cdf5013f074695
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sat Apr 1 12:05:49 2017 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Apr 12 21:33:47 2017 +0200

dmfilemapd: keep 1 byte for \0

Coverity noticed the buffer should have 1 byte for \0.

---
 daemons/dmfilemapd/dmfilemapd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
daemons/dmfilemapd/dmfilemapd.c +1 -1
index 88f8af2..d232a83 100644
@@ -589,7 +589,7 @@ check_unlinked:
 		log_error("Could not format pid path.");
 		return 0;
 	}
-	if ((len = readlink(path_buf, link_buf, sizeof(link_buf))) < 0) {
+	if ((len = readlink(path_buf, link_buf, sizeof(link_buf) - 1)) < 0) {
 		log_error("readlink failed for " DEFAULT_PROC_DIR "/%d/fd/%d.",
 			  getpid(), fm->fd);
 		return 0;