diff options
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h index 9c850e4..f9696e0 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -74,6 +74,14 @@ void cmark_strbuf_unescape(cmark_strbuf *s); /* Print error and abort. */ void cmark_strbuf_overflow_err(void); +static inline bufsize_t +cmark_strbuf_check_bufsize(size_t size) { + if (size > BUFSIZE_MAX) { + cmark_strbuf_overflow_err(); + } + return (bufsize_t)size; +} + #ifdef __cplusplus } #endif |