diff options
author | Oran Agra <oran@redislabs.com> | 2022-03-28 18:35:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-28 18:35:56 +0300 |
commit | 14b198868fd8f8c7cbd319bec369fbc3fb24aff6 (patch) | |
tree | 697849f07d2a07b45a36ab036cdc3ed897294296 /src/t_zset.c | |
parent | 3f28d7d712329261d0c56df77eef37c88d610cf3 (diff) | |
download | redis-14b198868fd8f8c7cbd319bec369fbc3fb24aff6.tar.gz |
introduce MAX_D2STRING_CHARS instead of 128 const (#10487)
There are a few places that use a hard coded const of 128 to allocate a buffer for d2string.
Replace these with a clear macro.
Note that In theory, converting double into string could take as much as nearly 400 chars,
but since d2string uses `%g` and not `%f`, it won't pass some 40 chars.
unrelated:
restore some changes to auto generated commands.c that got accidentally reverted in #10293
Diffstat (limited to 'src/t_zset.c')
-rw-r--r-- | src/t_zset.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/t_zset.c b/src/t_zset.c index 3710b62d7..77ca7c83a 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -1027,7 +1027,7 @@ unsigned char *zzlDelete(unsigned char *zl, unsigned char *eptr) { unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, sds ele, double score) { unsigned char *sptr; - char scorebuf[128]; + char scorebuf[MAX_D2STRING_CHARS]; int scorelen; scorelen = d2string(scorebuf,sizeof(scorebuf),score); |