diff --git a/frameworks/libhilog/vsnprintf/output_p.inl b/frameworks/libhilog/vsnprintf/output_p.inl index eb6ba050ff49a53068b7cc58aa54b2f986aa133e..7e015ba5eb8c406b1d79be083af08b52c27ffc75 100644 --- a/frameworks/libhilog/vsnprintf/output_p.inl +++ b/frameworks/libhilog/vsnprintf/output_p.inl @@ -494,6 +494,9 @@ int SecOutputPS(SecPrintfStream *stream, int priv, const char *cformat, va_list /* loop each format character */ /* remove format != NULL */ while ((ch = *format++) != SECUREC_CHAR('\0') && charsOut >= 0) { + if (!format) { + return -1; + } laststate = state; state = SECUREC_DECODE_STATE(ch, FMT_CHAR_TABLE, laststate);