diff options
author | Benny Baumann <BenBE@geshi.org> | 2022-05-09 20:56:43 +0200 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2022-05-10 12:12:46 +0200 |
commit | c24681a078d9eb94d7186896cd12bee527ae3750 (patch) | |
tree | 8789f5bca7a332e3ea20d074d1864eee6d0d9ce1 /Vector.c | |
parent | 2da8f71209d2d1c3bfe23f8a76ae4f965065e81f (diff) |
Fix heap buffer overflow in Vector_compact
Fixes: #1006
Diffstat (limited to 'Vector.c')
-rw-r--r-- | Vector.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -292,7 +292,7 @@ void Vector_compact(Vector* this) { /* one deletion: use memmove, which should be faster */ if (this->dirty_count == 1) { - memmove(&this->array[idx], &this->array[idx + 1], (this->items - idx) * sizeof(this->array[0])); + memmove(&this->array[idx], &this->array[idx + 1], (this->items - idx - 1) * sizeof(this->array[0])); } else { /* multiple deletions */ for (int i = idx + 1; i < size; i++) { |