Commit ff767a75 authored by antirez's avatar antirez
Browse files

free hash table entries about no longer active classes, so that PUBSUB can be...

free hash table entries about no longer active classes, so that PUBSUB can be abused with millions of different classes
parent 201037f5
...@@ -9312,6 +9312,12 @@ static int pubsubUnsubscribe(redisClient *c, robj *class, int notify) { ...@@ -9312,6 +9312,12 @@ static int pubsubUnsubscribe(redisClient *c, robj *class, int notify) {
ln = listSearchKey(clients,c); ln = listSearchKey(clients,c);
assert(ln != NULL); assert(ln != NULL);
listDelNode(clients,ln); listDelNode(clients,ln);
if (listLength(clients) == 0) {
/* Free the list and associated hash entry at all if this was
* the latest client, so that it will be possible to abuse
* Redis PUBSUB creating millions of classes. */
dictDelete(server.pubsub_classes,class);
}
} }
/* Notify the client */ /* Notify the client */
if (notify) { if (notify) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment