fix: call CLIENT INFO from redis module will crash the server (#8560)
Because when the RM_Call is invoked. It will create a faker client. The point is client connection is NULL, so server will crash in connGetInfo Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
This commit is contained in:
parent
1bf02e1ca9
commit
81a55d026f
@ -427,7 +427,7 @@ int connGetState(connection *conn) {
|
||||
* For sockets, we always return "fd=<fdnum>" to maintain compatibility.
|
||||
*/
|
||||
const char *connGetInfo(connection *conn, char *buf, size_t buf_len) {
|
||||
snprintf(buf, buf_len-1, "fd=%i", conn->fd);
|
||||
snprintf(buf, buf_len-1, "fd=%i", conn == NULL ? -1 : conn->fd);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -111,4 +111,8 @@ start_server {tags {"modules"}} {
|
||||
r test.log_tsctx "info" "Test message"
|
||||
verify_log_message 0 "*<misc> Test message*" 0
|
||||
}
|
||||
|
||||
test {test RM_Call CLIENT INFO} {
|
||||
assert_match "*fd=-1*" [r test.call_generic client info]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user