diff options
author | Sean McBride <sean@rogue-research.com> | 2022-06-22 18:58:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 18:58:18 (GMT) |
commit | c064d3481b582653c1e0d0043a17527fd73e8c4d (patch) | |
tree | 396a5e13954c19b803aa80465938cde15140b176 /src/H5Cmpio.c | |
parent | d6f05069c1a3642bbebf7ec27e7df809f0675f13 (diff) | |
download | hdf5-c064d3481b582653c1e0d0043a17527fd73e8c4d.zip hdf5-c064d3481b582653c1e0d0043a17527fd73e8c4d.tar.gz hdf5-c064d3481b582653c1e0d0043a17527fd73e8c4d.tar.bz2 |
sprintf to snprintf (#1815)
* Straightforward conversion of sprintf to the safer snprintf
* Trickier conversion of sprintf to safer snprintf
This involved minor changes to private function signatures to take the size of the buffer.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5Cmpio.c')
-rw-r--r-- | src/H5Cmpio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index a0cc6bb..a746e54 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -199,7 +199,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha HDmemset(tbl_buf, 0, sizeof(tbl_buf)); - HDsprintf(&(tbl_buf[0]), "candidate list = "); + HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate list = "); for (u = 0; u < num_candidates; u++) HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u))); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); @@ -266,7 +266,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha #if H5C_APPLY_CANDIDATE_LIST__DEBUG for (u = 0; u < 1024; u++) tbl_buf[u] = '\0'; - HDsprintf(&(tbl_buf[0]), "candidate assignment table = "); + HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate assignment table = "); for (u = 0; u <= (unsigned)mpi_size; u++) HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); |