diff --git a/src/client/dfs/dfs.c b/src/client/dfs/dfs.c index e05ed2e50bc..1956455bb2e 100644 --- a/src/client/dfs/dfs.c +++ b/src/client/dfs/dfs.c @@ -568,7 +568,7 @@ fetch_entry(dfs_layout_ver_t ver, daos_handle_t oh, daos_handle_t th, const char /** TODO - not supported yet */ if (strcmp(name, ".") == 0) - D_ASSERT(0); + return ENOTSUP; if (xnr) { D_ALLOC_ARRAY(pxnames, xnr); @@ -3790,11 +3790,8 @@ readdir_int(dfs_t *dfs, dfs_obj_t *obj, daos_anchor_t *anchor, uint32_t *nr, D_GOTO(out, rc = daos_der2errno(rc)); for (ptr = enum_buf, i = 0; i < number; i++) { - int len; - - len = snprintf(dirs[key_nr].d_name, - kds[i].kd_key_len + 1, "%s", ptr); - D_ASSERT(len >= kds[i].kd_key_len); + memcpy(dirs[key_nr].d_name, ptr, kds[i].kd_key_len); + dirs[key_nr].d_name[kds[i].kd_key_len] = '\0'; ptr += kds[i].kd_key_len; /** stat the entry if requested */ @@ -6542,8 +6539,6 @@ dfs_listxattr(dfs_t *dfs, dfs_obj_t *obj, char *list, daos_size_t *size) continue; for (ptr = enum_buf, i = 0; i < number; i++) { - int len; - if (strncmp("x:", ptr, 2) != 0) { ptr += kds[i].kd_key_len; continue; @@ -6556,10 +6551,8 @@ dfs_listxattr(dfs_t *dfs, dfs_obj_t *obj, char *list, daos_size_t *size) if (list_size < kds[i].kd_key_len - 2) continue; - len = snprintf(ptr_list, kds[i].kd_key_len - 1, "%s", - ptr + 2); - D_ASSERT(len >= kds[i].kd_key_len - 2); - + memcpy(ptr_list, ptr + 2, kds[i].kd_key_len - 2); + ptr_list[kds[i].kd_key_len - 2] = '\0'; list_size -= kds[i].kd_key_len - 1; ptr_list += kds[i].kd_key_len - 1; ptr += kds[i].kd_key_len;