From 217ac6058488a7b10dbddfff1056dc7317213601 Mon Sep 17 00:00:00 2001 From: armatusmiles Date: Fri, 25 Jan 2019 20:47:29 +0700 Subject: [PATCH] Fix runtime error during push zero size data to buffer with dataSize equals 0 --- CircularBuffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CircularBuffer.c b/CircularBuffer.c index e97812d..6feb108 100755 --- a/CircularBuffer.c +++ b/CircularBuffer.c @@ -58,6 +58,9 @@ size_t CircularBufferGetDataSize(CircularBuffer cBuf) void CircularBufferPush(CircularBuffer cBuf,void *src, size_t length) { + if(length == 0) + return; + size_t writableLen = length; void *pSrc = src;