diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2021-07-30 17:05:07 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-09-01 19:25:37 -0400 |
commit | 295ab733df05f673117d1576dd257afbba41366b (patch) | |
tree | e30a0f0fdbf06c49f2974860a80ebddff8493556 /lib/rsa | |
parent | ca47955a66161adf5d6e8f8e1de852ccda6626c0 (diff) | |
download | u-boot-295ab733df05f673117d1576dd257afbba41366b.tar.gz u-boot-295ab733df05f673117d1576dd257afbba41366b.tar.bz2 u-boot-295ab733df05f673117d1576dd257afbba41366b.zip |
lib: -Wformat-truncation in rsa_engine_get_priv_key
With glibc 2.33 (Ubuntu package glibc6 2.33-0ubuntu9) building
sifive_unmatched_defconfig results in:
In file included from /usr/include/stdio.h:866,
from ././include/compiler.h:26,
from <command-line>:
In function ‘snprintf’,
inlined from ‘rsa_engine_get_priv_key’ at ./tools/../^:273:4:
/usr/include/riscv64-linux-gnu/bits/stdio2.h:71:10: warning:
‘%s’ directive argument is null [-Wformat-truncation=]
71 | return __builtin___snprintf_chk (__s, __n,
__USE_FORTIFY_LEVEL - 1,
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
Avoid passing a NULL string.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/rsa')
-rw-r--r-- | lib/rsa/rsa-sign.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index 3bc28247e4..64db1429c1 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -254,7 +254,7 @@ static int rsa_engine_get_priv_key(const char *keydir, const char *name, else if (keydir) snprintf(key_id, sizeof(key_id), "%s", - name); + name ? name : ""); else if (keyfile) snprintf(key_id, sizeof(key_id), "%s", keyfile); else |