mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-18 20:57:56 +00:00
Fix bug in strbuf_reset()
Could write a nul char into a zero-size buffer.
This commit is contained in:
parent
23cd578595
commit
fc67b38fd2
4
strbuf.c
4
strbuf.c
@ -35,8 +35,8 @@ strbuf strbuf_init(strbuf sb, char *buffer, ssize_t size)
|
|||||||
strbuf strbuf_reset(strbuf sb)
|
strbuf strbuf_reset(strbuf sb)
|
||||||
{
|
{
|
||||||
sb->current = sb->start;
|
sb->current = sb->start;
|
||||||
if (sb->start)
|
if (sb->current && (!sb->end || (sb->current <= sb->end)))
|
||||||
*sb->start = '\0';
|
*sb->current = '\0';
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user