summaryrefslogtreecommitdiff
path: root/src/support/scratch.c
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2017-04-14 03:25:28 +1000
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-04-14 03:25:28 +1000
commitf5c08e2b5f02805b062888d45c9eca19af175f7e (patch)
tree0b43098fab6f6059c04c89e9b85337d5f625c5f2 /src/support/scratch.c
parentd48181f6f4db08761ed7b80b0332908b272ad0d0 (diff)
parentcb16839cfbdf338af95bed43ca40979ae6e32f54 (diff)
Merge branch 'mongodb-3.4' into mongodb-3.2mongodb-3.2.13
Diffstat (limited to 'src/support/scratch.c')
-rw-r--r--src/support/scratch.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/support/scratch.c b/src/support/scratch.c
index 69987ebc852..485cea90e89 100644
--- a/src/support/scratch.c
+++ b/src/support/scratch.c
@@ -69,13 +69,16 @@ int
__wt_buf_fmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4)))
{
+ WT_DECL_RET;
va_list ap;
size_t len;
for (;;) {
va_start(ap, fmt);
- len = (size_t)vsnprintf(buf->mem, buf->memsize, fmt, ap);
+ ret = __wt_vsnprintf_len_set(
+ buf->mem, buf->memsize, &len, fmt, ap);
va_end(ap);
+ WT_RET(ret);
/* Check if there was enough space. */
if (len < buf->memsize) {
@@ -100,6 +103,7 @@ int
__wt_buf_catfmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4)))
{
+ WT_DECL_RET;
va_list ap;
size_t len, space;
char *p;
@@ -117,8 +121,9 @@ __wt_buf_catfmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...)
p = (char *)((uint8_t *)buf->mem + buf->size);
WT_ASSERT(session, buf->memsize >= buf->size);
space = buf->memsize - buf->size;
- len = (size_t)vsnprintf(p, space, fmt, ap);
+ ret = __wt_vsnprintf_len_set(p, space, &len, fmt, ap);
va_end(ap);
+ WT_RET(ret);
/* Check if there was enough space. */
if (len < space) {