#14240 closed bug (fixed)

JPEGTranslator: Replace strncpy() with strlcpy()

Reported by: mt Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Add-Ons/Translators/JPEG Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

https://review.haiku-os.org/#/c/haiku/+/314/

Replace strncpy() with strlcpy(), since destination size equals maximum number of characters to copy. pointed by gcc8. [-Werror=stringop-truncation]

/home/haiku/haiku/haiku/src/add-ons/translators/jpeg/JPEGTranslator.cpp: In member function 'status_t JPEGTranslator::PopulateInfoFromFormat(translator_info*, uint32, const translation_format*, int32)':
/home/haiku/haiku/haiku/src/add-ons/translators/jpeg/JPEGTranslator.cpp:1284:11: error: 'char* strncpy(char*, const char*, size_t)' specified bound 251 equals destination size [-Werror=stringop-truncation]
    strncpy(info->name, str1.String(), sizeof(info->name));
    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change History (1)

comment:1 Changed 10 months ago by waddlesplash

Resolution: fixed
Status: newclosed

Merged.

Note: See TracTickets for help on using tickets.