diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-19 19:15:16 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-19 19:15:16 +0000 |
commit | 595d44647068451df0fb7033b0cba3ebfce53c42 (patch) | |
tree | 04b8f30d3ebaa208f7b4a5587bddabef37092299 /src/htssafe.h | |
parent | 0474c596b6fc5152a8dd28b518db0e33e4a3a632 (diff) |
Added strlcpybuff() macro.
Diffstat (limited to 'src/htssafe.h')
-rw-r--r-- | src/htssafe.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/htssafe.h b/src/htssafe.h index 57013fb..329d12a 100644 --- a/src/htssafe.h +++ b/src/htssafe.h @@ -150,6 +150,14 @@ static HTS_UNUSED void htssafe_compile_time_check_(void) { #define strlcatbuff(A, B, S) \ strncat_safe_(A, S, B, \ HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), (size_t) -1, \ + "overflow while appending '" #B "' to '"#A"'", __FILE__, __LINE__) + +/** + * Copy characters of "B" to "A", "A" having a maximum capacity of "S". + */ +#define strlcpybuff(A, B, S) \ + strcpy_safe_(A, S, B, \ + HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), \ "overflow while copying '" #B "' to '"#A"'", __FILE__, __LINE__) static HTS_INLINE HTS_UNUSED size_t strlen_safe_(const char *source, const size_t sizeof_source, |