blob: copy xattr name with memcpy()

We know exactly how long the name is, so there is no need to use a C
string function to copy it.

Change-Id: I21b5f1e318555b46729582ab6a1e6bd163c85205
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/406984
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2018-04-09 09:32:54 -07:00 committed by Jim Harris
parent ec7ef53221
commit d9135820c5

View File

@ -290,7 +290,7 @@ _spdk_blob_deserialize_xattr(struct spdk_blob *blob,
free(xattr);
return -ENOMEM;
}
strncpy(xattr->name, desc_xattr->name, desc_xattr->name_length);
memcpy(xattr->name, desc_xattr->name, desc_xattr->name_length);
xattr->name[desc_xattr->name_length] = '\0';
xattr->value = malloc(desc_xattr->value_length);