summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
738374b)
Strings are not copied correctly when the fsname or nodemap field of
a shared key is replaced. Instead of being zero-terminated, the new
string may overlap the original if it is smaller.
Fixed by using the buffer length instead of the string length in
strncpy().
Change-Id: I17bb5aa0ca7c25b2545c17c6f23e69045730a547
Test-Parameters: trivial
Signed-off-by: Chris Hanna <hannac@iu.edu>
Reviewed-on: https://review.whamcloud.com/26165
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Kit Westneat <kit.westneat@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
generate_prime = type & SK_TYPE_CLIENT;
strncpy(config->skc_nodemap, SK_DEFAULT_NODEMAP,
generate_prime = type & SK_TYPE_CLIENT;
strncpy(config->skc_nodemap, SK_DEFAULT_NODEMAP,
- strlen(SK_DEFAULT_NODEMAP));
+ sizeof(config->skc_nodemap) - 1);
if (!datafile)
datafile = "/dev/random";
if (!datafile)
datafile = "/dev/random";
if (prime_bits != -1)
config->skc_prime_bits = prime_bits;
if (fsname)
if (prime_bits != -1)
config->skc_prime_bits = prime_bits;
if (fsname)
- strncpy(config->skc_fsname, fsname, strlen(fsname));
+ strncpy(config->skc_fsname, fsname,
+ sizeof(config->skc_fsname) - 1);
- strncpy(config->skc_nodemap, nodemap, strlen(nodemap));
+ strncpy(config->skc_nodemap, nodemap,
+ sizeof(config->skc_nodemap) - 1);
if (mgsnids && parse_mgsnids(mgsnids, config))
goto error;
if (sk_validate_config(config)) {
if (mgsnids && parse_mgsnids(mgsnids, config))
goto error;
if (sk_validate_config(config)) {