From d9135820c5b0a1a1ce6797993464ab575865b4d9 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 9 Apr 2018 09:32:54 -0700 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/406984 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/blob/blobstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 5dee2faa0..e736da9be 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -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);