提交 1414e09b 编写于 作者: M Masahiro Yamada 提交者: Tom Rini

kconfig: revert change that was not needed for -Wformat-security

Recent GCC versions warn if the format string is not a literal
because the compiler cannot check the argument validity at compile
time.

Commit 192bc694 ("Fix GCC format-security errors and convert
sprintfs.") blindly replaced sprintf() with strcpy(), including
many cases where the format parameter is a string literal.

For the kconfig change:

    sprintf(header, "   ");

..., here the format parameter is a string literal "   ", so it is
definitely equivalent to:

    strcpy(header, "   ");

Of course, if the 'header' did not have enough length for containing
"   ", it would be a security problem, but another problem.  (in this
case, the 'header' is 4 byte length buffer, so it is not a problem at
all.)

The kconfig code is kept as synced with Linux as possible, but this
change made the code out-of-sync for nothing.  Just reverting.
Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
上级 f39bfec2
......@@ -379,7 +379,7 @@ static void update_text(char *buf, size_t start, size_t end, void *_data)
data->targets[k] = pos->target;
k++;
} else {
strcpy(header, " ");
sprintf(header, " ");
}
memcpy(buf + pos->offset, header, sizeof(header) - 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册