diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2015-06-07 14:49:18 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2015-06-07 21:42:15 +0200 |
commit | 09cee35add8c8686a3982f3f31de283450b625eb (patch) | |
tree | c5bae591010745a9d86265334e2e62551820ae78 /src | |
parent | ad94c00083285703144e4874642fb89dac2f5446 (diff) |
Fix check in cmark_strbuf_vprintf
Avoid potential overflow and allow for different bufsize types.
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c index db575ed..08192da 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -192,8 +192,7 @@ void cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap) abort(); } - // TODO: Check for overflow. - if (len + 1 <= buf->asize - buf->size) { + if ((size_t)len < (size_t)(buf->asize - buf->size)) { buf->size += len; break; } |