diff --git a/frameworks/mini/hiview_output_log.c b/frameworks/mini/hiview_output_log.c index 7b948c738544c210b3abecf08d218c62b3a0bfa4..bce687f633bf8f0d2bc3652621f31c0ac6fa9873 100644 --- a/frameworks/mini/hiview_output_log.c +++ b/frameworks/mini/hiview_output_log.c @@ -500,13 +500,13 @@ static void RemovePrivacyFmt(const char* fmtStr, size_t fmtLen, char* arr, size_ static int32 LogDebugValuesFmt(char *desStrPtr, int32 desLen, const HiLogContent *logContentPtr) { int32 ret = 0; - size_t fmtLen = strlen(logContentPtr->commonContent.fmt); + size_t fmtLen = strlen(logContentPtr->commonContent.fmt) + 1; char *fmt = (char *)malloc(fmtLen * sizeof(char)); if (fmt == NULL) { return -1; } memset_s(fmt, fmtLen, 0, fmtLen); - RemovePrivacyFmt(logContentPtr->commonContent.fmt, fmtLen, fmt, fmtLen); + RemovePrivacyFmt(logContentPtr->commonContent.fmt, fmtLen - 1, fmt, fmtLen - 1); switch (logContentPtr->commonContent.valueNumber) { case LOG_MULTI_PARA_0: ret = strncpy_s(desStrPtr, desLen, fmt, desLen - 1);