mirror of
https://github.com/wassname/ray.git
synced 2026-09-11 12:43:20 +08:00
Fix improper handling of NULL characters when opening Redis keys. (#136)
* Fix improper handling of NULL characters when opening Redis keys. * Add test.
This commit is contained in:
committed by
Philipp Moritz
parent
a9e6a53360
commit
c89bf4e5bc
@@ -35,8 +35,11 @@ RedisModuleString *CreatePrefixedString(RedisModuleCtx *ctx,
|
||||
RedisModuleString *keyname) {
|
||||
size_t length;
|
||||
const char *value = RedisModule_StringPtrLen(keyname, &length);
|
||||
RedisModuleString *prefixed_keyname = RedisModule_CreateStringPrintf(
|
||||
ctx, "%s%*.*s", prefix, length, length, value);
|
||||
RedisModuleString *prefixed_keyname =
|
||||
RedisModule_CreateString(ctx, prefix, strlen(prefix));
|
||||
/* Using RedisModule_CreateStringPrintf in the past did not handle NULL
|
||||
* characters properly. */
|
||||
RedisModule_StringAppendBuffer(ctx, prefixed_keyname, value, length);
|
||||
return prefixed_keyname;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user