libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

commit 73e1ceda198b9145ac29a9a99bfcbdda4acade59
parent 99fc598068825661fa07f5a1b6e9c63df0d21c9f
Author: Remy Noulin <loader2x@gmail.com>
Date:   Sun, 21 Jul 2019 15:17:48 +0200

fix bug in sliceInject (was writing outside buffers and corrupting the heap)

src/libsheepy.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Diffstat:
Msrc/libsheepy.h | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libsheepy.h b/src/libsheepy.h @@ -3370,7 +3370,9 @@ void **iListDel(void ***list, intmax_t start, intmax_t end); #define sliceInject(name, index) do {\ var UNIQVAR(idx) = index;\ slicePush(name);\ - memmove(slicePtr(name, UNIQVAR(idx) +1), slicePtr(name, UNIQVAR(idx)), ((name)->count - UNIQVAR(idx)) * sizeof (name)->array[0]);\ + if (index < sliceCount(name)) {\ + memmove(slicePtr(name, UNIQVAR(idx) +1), slicePtr(name, UNIQVAR(idx)), ((name)->count - UNIQVAR(idx)-1) * sizeof (name)->array[0]);\ + }\ } while(0) /**