thin-provisioning-tools/6001-restore_emitter-squash-a-strncpy-warning.patch
2020-01-10 17:17:23 +08:00

26 lines
905 B
Diff

From 9b1acc658fdf5b066a2afc5324de8e3067fa5912 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Tue, 9 Apr 2019 21:29:33 +0800
Subject: [PATCH 2/4] [restore_emitter] squash a strncpy warning
---
caching/restore_emitter.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/caching/restore_emitter.cc b/caching/restore_emitter.cc
index b7a573f..5c30b9f 100644
--- a/caching/restore_emitter.cc
+++ b/caching/restore_emitter.cc
@@ -26,7 +26,7 @@ namespace {
superblock &sb = md_->sb_;
sb.version = metadata_version_;
- strncpy((char *) sb.policy_name, policy.c_str(), sizeof(sb.policy_name));
+ strncpy((char *) sb.policy_name, policy.c_str(), sizeof(sb.policy_name) - 1);
memset(sb.policy_version, 0, sizeof(sb.policy_version)); // FIXME: should come from xml
sb.policy_hint_size = hint_width;
md_->setup_hint_array(hint_width);
--
2.19.1