New Defects reported by Coverity Scan for Osmocom

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Wed Sep 15 06:15:55 UTC 2021


On Tue, Sep 14, 2021 at 02:45:51AM +0000, scan-admin at coverity.com wrote:
> 178     	} else {
> >>>     CID 240100:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
> >>>     Calling "strncpy" with a maximum size argument of 64 bytes on destination array "codec->audio_name" of size 64 bytes might leave the destination string unterminated.
> 179     		strncpy(codec->audio_name, audio_name, sizeof(codec->audio_name));

strncpy() is another word for pitfall.
We should *always* use osmo_strlcpy(), or OSMO_STRLCPY_ARRAY() to save typing 'sizeof'.

osmith, could we put such a check in the linter maybe?
i.e. forbid use of strncpy() and strcpy().

~N



More information about the OpenBSC mailing list