summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangtaoXT5 <50564994+zhangtaoXT5@users.noreply.github.com>2022-09-02 04:45:28 +0800
committerGitHub <noreply@github.com>2022-09-01 13:45:28 -0700
commitbc8d837b72aa226ac1b0c4e112ad08ed8da6d0d3 (patch)
treea87aa4e8d15ad75cc1f1c82259390719df497307
parentca4a0e850b9978104980ce980997f7a351376994 (diff)
fix heap-buffer-overflow (#957)
Prevent incrementing passed a `\0` in our format string. Co-authored-by: Michael Grunder <michael.grunder@gmail.com> Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com>
-rw-r--r--hiredis.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hiredis.c b/hiredis.c
index c0968ed..a3b3edd 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -485,6 +485,8 @@ int redisvFormatCommand(char **target, const char *format, va_list ap) {
touched = 1;
c++;
+ if (*c == '\0')
+ break;
}
c++;
}