Skip to content

Commit

Permalink
apr_buffer: Use memcpy instead of strncpy inside apr_buffer_pstrncat(…
Browse files Browse the repository at this point in the history
…), the

terminating zero is set at the end.


git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1917268 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
minfrin committed Apr 22, 2024
1 parent d409804 commit f60473b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions buffer/apr_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,12 @@ APR_DECLARE(char *) apr_buffer_pstrncat(apr_pool_t *p, const apr_buffer_t *buf,
for (i = 0; i < nelts; i++) {

if (i > 0 && sep) {
strncpy(dst, sep, seplen);
memcpy(dst, sep, seplen);
dst += seplen;
}

if (src->zero_terminated) {
strncpy(dst, src->d.str, src->size);
memcpy(dst, src->d.str, src->size);
dst += src->size;
}
else {
Expand Down

0 comments on commit f60473b

Please sign in to comment.