diff --git a/meta-ohos-core/recipes-core/ncurses/ncurses_%.bbappend b/meta-ohos-core/recipes-core/ncurses/ncurses_%.bbappend
new file mode 100644
index 0000000000000000000000000000000000000000..208b41155767302bc4c91a0ac1247d377303440c
--- /dev/null
+++ b/meta-ohos-core/recipes-core/ncurses/ncurses_%.bbappend
@@ -0,0 +1,13 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+# ncurses' termcap to terminfo converter uses a non-literal
+# format string.
+# This has been verified to be harmless in 6.2 (the "unsafe"
+# use of sscanf happens only with hardcoded, safe strings).
+#
+# Removing -Werror=format-nonliteral here allows us to use
+# -Werror=format-nonliteral globally in OPTIMIZE_FOR=security mode
+# while keeping ncurses building.
+
+TARGET_CFLAGS_remove = "-Werror=format-nonliteral"