Saw an asan issue here.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3708 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
c590eb3a44
commit
9f0315458f
@ -64,13 +64,13 @@ static int64_t _trace_ts()
|
|||||||
|
|
||||||
static void _trace_append(tf_trace_t* trace, const char* buffer, size_t size)
|
static void _trace_append(tf_trace_t* trace, const char* buffer, size_t size)
|
||||||
{
|
{
|
||||||
if (trace->write_offset + size >= k_buffer_size)
|
if (trace->write_offset + size + 2 >= k_buffer_size)
|
||||||
{
|
{
|
||||||
trace->buffer[trace->write_offset] = '\0';
|
trace->buffer[trace->write_offset] = '\0';
|
||||||
trace->write_offset = 0;
|
trace->write_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trace->write_offset + size < k_buffer_size)
|
if (trace->write_offset + size + 2 < k_buffer_size)
|
||||||
{
|
{
|
||||||
memcpy(trace->buffer + trace->write_offset, buffer, size);
|
memcpy(trace->buffer + trace->write_offset, buffer, size);
|
||||||
trace->write_offset += size;
|
trace->write_offset += size;
|
||||||
|
Loading…
Reference in New Issue
Block a user