summaryrefslogtreecommitdiff
path: root/src/sds.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2021-07-01 08:19:04 +0300
committerGitHub <noreply@github.com>2021-07-01 08:19:04 +0300
commitde9bae21efa2e14d71bdedb3326abacbb310135c (patch)
tree3d3813442953f3abb42af5cfe7b5d96fdb842609 /src/sds.c
parent16e04ed9442ed31ab2ec01035047e8118c7511a5 (diff)
downloadredis-de9bae21efa2e14d71bdedb3326abacbb310135c.tar.gz
Fix bug in sdscatfmt when % is the last format char (#9173)
For the sdscatfmt function in sds.c, when the parameter fmt ended up with '%', the behavior is undefined. This commit fix this bug. Co-authored-by: stafuc <stafuc@gmail.com>
Diffstat (limited to 'src/sds.c')
-rw-r--r--src/sds.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/sds.c b/src/sds.c
index 036d714d4..e722abbca 100644
--- a/src/sds.c
+++ b/src/sds.c
@@ -682,6 +682,7 @@ sds sdscatfmt(sds s, char const *fmt, ...) {
switch(*f) {
case '%':
next = *(f+1);
+ if (next == '\0') break;
f++;
switch(next) {
case 's':