summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2015-06-07 14:49:18 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2015-06-07 21:42:15 +0200
commit09cee35add8c8686a3982f3f31de283450b625eb (patch)
treec5bae591010745a9d86265334e2e62551820ae78 /src
parentad94c00083285703144e4874642fb89dac2f5446 (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.c3
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;
}