Skip to content

Commit

Permalink
DAOS-16501 build: Add libsanitize
Browse files Browse the repository at this point in the history
Revert gcc strigop-truncation warning.

Signed-off-by: Cedric Koch-Hofer <[email protected]>
  • Loading branch information
kanard38 authored and knard38 committed Feb 6, 2025
1 parent 8e5d47d commit 79d730f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/client/dfs/cont.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ dfs_cont_create(daos_handle_t poh, uuid_t *cuuid, dfs_attr_t *attr, daos_handle_
if (attr->da_hints[0] != 0) {
/* DAOS-17042 Replace strncpy with strncat or strlcpy */
strncpy(dattr.da_hints, attr->da_hints, DAOS_CONT_HINT_MAX_LEN - 1);
dattr.da_hints[DAOS_CONT_HINT_MAX_LEN - 1] = NULL;
dattr.da_hints[DAOS_CONT_HINT_MAX_LEN - 1] = '\0';
}
} else {
dattr.da_oclass_id = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/client/dfs/obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ dfs_dup(dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **_new_obj)

/* DAOS-17042 Replace strncpy with strncat or strlcpy */
strncpy(new_obj->name, obj->name, DFS_MAX_NAME);
new_obj->name[DFS_MAX_NAME] = NULL;
new_obj->name[DFS_MAX_NAME] = '\0';
new_obj->dfs = dfs;
new_obj->mode = obj->mode;
new_obj->flags = flags;
Expand Down Expand Up @@ -621,7 +621,7 @@ dfs_obj_local2global(dfs_t *dfs, dfs_obj_t *obj, d_iov_t *glob)
uuid_copy(obj_glob->cont_uuid, cont_uuid);
/* DAOS-17042 Replace strncpy with strncat or strlcpy */
strncpy(obj_glob->name, obj->name, DFS_MAX_NAME);
obj_glob->name[DFS_MAX_NAME] = NULL;
obj_glob->name[DFS_MAX_NAME] = '\0';
if (S_ISDIR(obj_glob->mode))
return 0;
rc = dfs_get_chunk_size(obj, &obj_glob->chunk_size);
Expand Down Expand Up @@ -680,7 +680,7 @@ dfs_obj_global2local(dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **_obj)
oid_cp(&obj->parent_oid, obj_glob->parent_oid);
/* DAOS-17042 Replace strncpy with strncat or strlcpy */
strncpy(obj->name, obj_glob->name, DFS_MAX_NAME);
obj->name[DFS_MAX_NAME] = NULL;
obj->name[DFS_MAX_NAME] = '\0';
obj->mode = obj_glob->mode;
obj->dfs = dfs;
obj->flags = flags ? flags : obj_glob->flags;
Expand Down
6 changes: 3 additions & 3 deletions src/client/dfuse/ops/lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ dfuse_reply_entry(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie,
wipe_parent = inode->ie_parent;
/* DAOS-17042 Replace strncpy with strncat or strlcpy */
strncpy(wipe_name, inode->ie_name, NAME_MAX);
wipe_name[NAME_MAX] = NULL;
wipe_name[NAME_MAX] = '\0';

inode->ie_parent = ie->ie_parent;
/* DAOS-17042 Replace strncpy with strncat or strlcpy */
strncpy(inode->ie_name, ie->ie_name, NAME_MAX);
inode->ie_name[NAME_MAX] = NULL;
inode->ie_name[NAME_MAX] = '\0';
}
atomic_fetch_sub_relaxed(&ie->ie_ref, 1);
dfuse_ie_close(dfuse_info, ie);
Expand Down Expand Up @@ -300,7 +300,7 @@ dfuse_cb_lookup(fuse_req_t req, struct dfuse_inode_entry *parent,

/* DAOS-17042 Replace strncpy with strncat or strlcpy */
strncpy(ie->ie_name, name, NAME_MAX);
ie->ie_name[NAME_MAX] = NULL;
ie->ie_name[NAME_MAX] = '\0';

dfs_obj2id(ie->ie_obj, &ie->ie_oid);

Expand Down

0 comments on commit 79d730f

Please sign in to comment.