diff --git a/include/buffer/cc_buf.h b/include/buffer/cc_buf.h index f0d7924db..4fe111dd3 100644 --- a/include/buffer/cc_buf.h +++ b/include/buffer/cc_buf.h @@ -169,6 +169,10 @@ buf_read(char *dst, struct buf *src, uint32_t count) static inline uint32_t buf_write(struct buf *dst, char *src, uint32_t count) { + if (count == 0) { + return 0; + } + ASSERT(dst != NULL && src != NULL); uint32_t len = MIN(buf_wsize(dst), count); diff --git a/src/cc_print.c b/src/cc_print.c index 22b5ee4ff..8a16430f5 100644 --- a/src/cc_print.c +++ b/src/cc_print.c @@ -60,7 +60,7 @@ cc_print_int64_unsafe(char *buf, int64_t n) } d = digits(ab); - _print_uint64(buf, d, n); + _print_uint64(buf, d, ab); return d + (n < 0); }