summaryrefslogtreecommitdiff
path: root/src/tracking.c
diff options
context:
space:
mode:
authorEran Liberty <eranl@amazon.com>2019-12-05 13:37:11 +0000
committerEran Liberty <eranl@amazon.com>2019-12-05 13:37:11 +0000
commit08c3fe8063b0a7e477dee8036ff5409a48c6f9a9 (patch)
tree5f154216b8ba01f9f076ea86fba617e064fd8833 /src/tracking.c
parentef5186d9207be43b1e828fa99b633701bdb3c577 (diff)
downloadredis-08c3fe8063b0a7e477dee8036ff5409a48c6f9a9.tar.gz
- memcpy(&id,ri.key,ri.key_len);
+ memcpy(&id,ri.key,sizeof(id)); The memcpy from the key to the id reliease on the fact that this key *should* be 8 bytes long as it was entered as such a few lines up the code. BUT if someone will change the code to the point this is no longer true, current code can trash the stack which makes debugging very hard while this fix will result in some garbage id, or even page fault. Both are preferable to stack mangaling.
Diffstat (limited to 'src/tracking.c')
-rw-r--r--src/tracking.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tracking.c b/src/tracking.c
index f7f0fc755..acb97800a 100644
--- a/src/tracking.c
+++ b/src/tracking.c
@@ -164,7 +164,7 @@ void trackingInvalidateSlot(uint64_t slot) {
raxSeek(&ri,"^",NULL,0);
while(raxNext(&ri)) {
uint64_t id;
- memcpy(&id,ri.key,ri.key_len);
+ memcpy(&id,ri.key,sizeof(id));
client *c = lookupClientByID(id);
if (c == NULL || !(c->flags & CLIENT_TRACKING)) continue;
sendTrackingMessage(c,slot);