summaryrefslogtreecommitdiffstats
path: root/user_channel/user_mgmt.cpp
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-11-21 15:24:44 -0500
committerTom Joseph <tomjoseph@in.ibm.com>2018-11-28 14:37:56 +0000
commit77ff3fe596532f965d86691f20031babcede775d (patch)
tree86d07c7c1b6ebbd958780e2d5125960ee7af0c7d /user_channel/user_mgmt.cpp
parentb975c4051e969bdb23ef18fa97224ee4d80882c3 (diff)
downloadphosphor-host-ipmid-77ff3fe596532f965d86691f20031babcede775d.tar.gz
phosphor-host-ipmid-77ff3fe596532f965d86691f20031babcede775d.zip
users: gcc8: fix stringop-truncation warnings
Avoid errors such as: | ../git/user_channel/user_mgmt.cpp: In member function 'ipmi_ret_t ipmi::UserAccess::setUserName(const uint8_t&, const char*)': | ../git/user_channel/user_mgmt.cpp:793:21: error: 'char* strncpy(char*, const char*, size_t)' specified bound 16 equals destination size [-Werror=stringop-truncation] | std::strncpy(reinterpret_cast<char*>(userInfo->userName), | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | userNameInChar, ipmiMaxUserName); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: Ie6ceea49366dc3f3918f31dec3c792276c3a206f Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'user_channel/user_mgmt.cpp')
-rw-r--r--user_channel/user_mgmt.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 7a11ff3..af72540 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -819,8 +819,7 @@ ipmi_ret_t UserAccess::setUserName(const uint8_t& userId,
entry("PATH=%s", userMgrObjBasePath));
return IPMI_CC_UNSPECIFIED_ERROR;
}
- std::strncpy(reinterpret_cast<char*>(userInfo->userName),
- userNameInChar, ipmiMaxUserName);
+ std::memcpy(userInfo->userName, userNameInChar, ipmiMaxUserName);
userInfo->userInSystem = true;
}
else if (oldUser != newUser && validUser)
@@ -845,8 +844,7 @@ ipmi_ret_t UserAccess::setUserName(const uint8_t& userId,
static_cast<uint8_t*>(userInfo->userName) +
sizeof(userInfo->userName),
0);
- std::strncpy(reinterpret_cast<char*>(userInfo->userName),
- userNameInChar, ipmiMaxUserName);
+ std::memcpy(userInfo->userName, userNameInChar, ipmiMaxUserName);
ipmiRenameUserEntryPassword(oldUser, newUser);
userInfo->userInSystem = true;
}
OpenPOWER on IntegriCloud