]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi: add assert to silence coverity
authorLuca Boccassi <bluca@debian.org>
Sat, 15 Jul 2023 23:39:13 +0000 (00:39 +0100)
committerLuca Boccassi <bluca@debian.org>
Sat, 15 Jul 2023 23:39:13 +0000 (00:39 +0100)
CID#1502668

src/boot/efi/efi-string.c

index 440059125596d9e04a5ecf8e7cbe94f9acc9ba69..ffe855245304795641e9ed69a6e1f3954e25913e 100644 (file)
@@ -544,9 +544,11 @@ static bool push_str(FormatContext *ctx, SpecifierContext *sp) {
         if (sp->wstr && sizeof(wchar_t) == sizeof(char16_t)) {
                 memcpy(ctx->buf + ctx->n, sp->wstr, sp->len * sizeof(*sp->wstr));
                 ctx->n += sp->len;
-        } else
+        } else {
+                assert(sp->str || sp->wstr);
                 for (size_t i = 0; i < sp->len; i++)
                         ctx->buf[ctx->n++] = sp->str ? sp->str[i] : sp->wstr[i];
+        }
 
         if (sp->align_left)
                 push_padding(ctx, ' ', sp->padded_len);