diff options
-rw-r--r-- | src/openvpn/buffer.h | 5 | ||||
-rw-r--r-- | src/openvpn/options.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h index 93efb09..d306a04 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -308,7 +308,10 @@ has_digit (const unsigned char* src) } /* - * printf append to a buffer with overflow check + * printf append to a buffer with overflow check, + * due to usage of vsnprintf, it will leave space for + * a final null character and thus use only + * capacity - 1 */ bool buf_printf (struct buffer *buf, const char *format, ...) #ifdef __GNUC__ diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 99c0187..007bd8c 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3766,7 +3766,7 @@ read_inline_file (struct in_src *is, const char *close_tag, struct gc_arena *gc) endtagfound = true; break; } - if (!buf_safe (&buf, strlen(line))) + if (!buf_safe (&buf, strlen(line)+1)) { /* Increase buffer size */ struct buffer buf2 = alloc_buf (buf.capacity * 2); |