buffer.c: fix 'off-by-one' error in 'buffer_cstr()'
This commit is contained in:
parent
107aae0105
commit
484dadc916
1 changed files with 1 additions and 1 deletions
2
buffer.c
2
buffer.c
|
|
@ -52,7 +52,7 @@ void buffer_expand(struct buffer *b, size_t len) {
|
|||
char* buffer_cstr(struct buffer *b) {
|
||||
|
||||
buffer_expand(b, 1);
|
||||
b->block[b->len + 1] = '\0';
|
||||
b->block[b->len] = '\0';
|
||||
|
||||
return (char*) b->block;
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue