[PATCH 5/7] erofs-utils: lib: fix `STRING_NULL` in nbd.c

Gao Xiang <[email protected]> Tue, 30 Jun 2026 10:52:22 +0800
Newsgroups org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>
Coverity-id: 647257
Signed-off-by: Gao Xiang <[email protected]>
---
 lib/backends/nbd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/backends/nbd.c b/lib/backends/nbd.c
index c488053d99d3..db0df44990b6 100644
--- a/lib/backends/nbd.c
+++ b/lib/backends/nbd.c
@@ -82,6 +82,7 @@ long erofs_nbd_in_service(int nbdnum)
 		return err;
 	}
 	close(fd);
+	s[sizeof(s) - 1] = '\0';
 	return strtol(s, NULL, 10);
 }
 
-- 
2.43.5