From d8ac56b8fb6f7af1e644a3109e9b97b2626a558a Mon Sep 17 00:00:00 2001 From: Shuo Date: Thu, 2 Apr 2020 15:01:23 +0800 Subject: [PATCH] fix(asan): global-buffer-overflow in function escape_sds_argv of data_operations.cpp (#509) Co-authored-by: HuangWei Co-authored-by: Wu Tao --- src/shell/commands/data_operations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shell/commands/data_operations.cpp b/src/shell/commands/data_operations.cpp index b9dad86f38..3ce7540ecd 100644 --- a/src/shell/commands/data_operations.cpp +++ b/src/shell/commands/data_operations.cpp @@ -2430,7 +2430,7 @@ void escape_sds_argv(int argc, sds *argv) { for (int i = 0; i < argc; i++) { const size_t dest_len = sdslen(argv[i]) * 4 + 1; // Maximum possible expansion - sds new_arg = sdsnewlen("", dest_len); + sds new_arg = sdsnewlen(NULL, dest_len); pegasus::utils::c_escape_string(argv[i], sdslen(argv[i]), new_arg, dest_len); sdsfree(argv[i]); argv[i] = new_arg;