authorgravatar for shawn@git.icuShawn Landden <shawn@git.icu> 2019-06-16 13:17:33-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-16 14:26:38-04:00
log4d3356435f453bdc24ac3c6c2da74d98c981db15
treee3d18f2e6097b669b30b5c4b5c97b3423b747247
parentf4b8850002d5f617450a9d08b05519f390bd3f21

stage1: check for null in buf_len and buf_ptr

follow up for f4b8850002d5

1 files changed, 2 insertions(+), 0 deletions(-)

src/buffer.hpp+2
...@@ -27,11 +27,13 @@ Buf *buf_sprintf(const char *format, ...)...@@ -27,11 +27,13 @@ Buf *buf_sprintf(const char *format, ...)
27Buf *buf_vprintf(const char *format, va_list ap);27Buf *buf_vprintf(const char *format, va_list ap);
2828
29static inline size_t buf_len(Buf *buf) {29static inline size_t buf_len(Buf *buf) {
30 assert(buf);
30 assert(buf->list.length);31 assert(buf->list.length);
31 return buf->list.length - 1;32 return buf->list.length - 1;
32}33}
3334
34static inline char *buf_ptr(Buf *buf) {35static inline char *buf_ptr(Buf *buf) {
36 assert(buf);
35 assert(buf->list.length);37 assert(buf->list.length);
36 return buf->list.items;38 return buf->list.items;
37}39}