From 1e4ea7c3518f3717aad00eee8eabbfeda880b71c Mon Sep 17 00:00:00 2001 From: Murai Takashi Date: Wed, 14 Oct 2020 21:08:28 +0900 Subject: [PATCH] WebPTranslator: Fix -Wformat-security Change-Id: Ide2ea81d8c66684d3bd101599ae2110970f3f66b Reviewed-on: https://review.haiku-os.org/c/haiku/+/3321 Reviewed-by: Adrien Destugues --- src/add-ons/translators/webp/WebPTranslator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/translators/webp/WebPTranslator.cpp b/src/add-ons/translators/webp/WebPTranslator.cpp index cfc41ae8f9..54447049c5 100644 --- a/src/add-ons/translators/webp/WebPTranslator.cpp +++ b/src/add-ons/translators/webp/WebPTranslator.cpp @@ -142,16 +142,16 @@ WebPTranslator::DerivedIdentify(BPositionIO* stream, ssize_t size = sizeof(buf); if (stream->Read(buf, size) != size) return B_IO_ERROR; - + // Check it's a valid WebP format if (!WebPGetInfo((const uint8_t*)buf, size, NULL, NULL)) return B_ILLEGAL_DATA; - + info->type = WEBP_IMAGE_FORMAT; info->group = B_TRANSLATOR_BITMAP; info->quality = WEBP_IN_QUALITY; info->capability = WEBP_IN_CAPABILITY; - snprintf(info->name, sizeof(info->name), B_TRANSLATE("WebP image")); + strlcpy(info->name, B_TRANSLATE("WebP image"), sizeof(info->name)); strcpy(info->MIME, "image/webp"); return B_OK; @@ -340,7 +340,7 @@ WebPTranslator::_TranslateFromWebP(BPositionIO* stream, BMessage* ioExtension, FreeAllocation _(out); - uint32 dataSize = width * 4 * height; + uint32 dataSize = width * 4 * height; TranslatorBitmap bitmapHeader; bitmapHeader.magic = B_TRANSLATOR_BITMAP;