From 6635a583cdffcc810d51462f75cd752e6ad81c20 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 15 Oct 2023 22:02:59 +0300 Subject: [PATCH 32/32] mapimg_help(): Fix format-overflow warning See osdn #48850 Signed-off-by: Marko Lindqvist --- common/mapimg.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/mapimg.c b/common/mapimg.c index 13670f7af2..661b5e1311 100644 --- a/common/mapimg.c +++ b/common/mapimg.c @@ -620,6 +620,7 @@ char *mapimg_help(const char *cmdname) tool = imagetool_next(tool)) { enum imageformat format; const struct toolkit *toolkit = img_toolkit_get(tool); + const char *separator = ""; if (!toolkit) { continue; @@ -627,12 +628,15 @@ char *mapimg_help(const char *cmdname) astr_add(&str_format, " - '%s': ", imagetool_name(tool)); - const char *separator = ""; for (format = imageformat_begin(); format != imageformat_end(); format = imageformat_next(format)) { if (toolkit->formats & format) { - astr_add(&str_format, "%s'%s'", separator, imageformat_name(format)); - separator = ", "; + const char *name = imageformat_name(format); + + if (name != NULL) { + astr_add(&str_format, "%s'%s'", separator, name); + separator = ", "; + } } } -- 2.42.0