mirror of
https://github.com/redis/redis.git
synced 2026-05-28 04:02:46 -04:00
Fix incorrect memmove size in LDB breakpoint deletion (#15115)
# Description There is an array corruption bug in LDB caused by an incorrect size argument being passed to `memmove()` inside the `ldbDelBreakpoint()` function. When deleting a breakpoint, `memmove()` is used to shift the remaining breakpoints in the ldb.bp integer array forward. However, the size parameter passes the number of elements rather than the number of bytes. Because ldb.bp is an array of type `int`, this results in an under-copy.
This commit is contained in:
parent
7bdab45ff1
commit
bf432c98fd
1 changed files with 1 additions and 1 deletions
|
|
@ -1027,7 +1027,7 @@ int ldbDelBreakpoint(int line) {
|
|||
for (j = 0; j < ldb.bpcount; j++) {
|
||||
if (ldb.bp[j] == line) {
|
||||
ldb.bpcount--;
|
||||
memmove(ldb.bp+j,ldb.bp+j+1,ldb.bpcount-j);
|
||||
memmove(ldb.bp+j,ldb.bp+j+1,(ldb.bpcount-j) * sizeof(int));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue