Skip to content

Commit

Permalink
mfu: use strncpy to pad short paths with zero when writing cache file
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Moody <moody20@llnl.gov>
  • Loading branch information
adammoody committed Jul 6, 2020
1 parent 9e1b465 commit eaadf86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/mfu_flist_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void buft_pack(void* buf, const buf_t* items)
sptr += items->chars;
dptr += items->chars;

/* pack uint64 into destionation */
/* pack uint64 into destination */
mfu_pack_io_uint64(&dptr, *(const uint64_t*)sptr);
sptr += sizeof(uint64_t);
}
Expand Down Expand Up @@ -247,7 +247,7 @@ static size_t list_elem_pack(void* buf, int detail, uint64_t chars, const elem_t

/* copy in file name */
char* file = elem->file;
strcpy(ptr, file);
strncpy(ptr, file, chars);
ptr += chars;

if (detail) {
Expand Down

0 comments on commit eaadf86

Please sign in to comment.