]> git.alsa-project.org Git - alsa-gobject.git/commit
seq: use safer way to copy strings topic/fix-misc-bugs
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 28 Aug 2021 02:51:36 +0000 (11:51 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 28 Aug 2021 02:51:36 +0000 (11:51 +0900)
commitb35a8deac541f53739f214595c3766d0a08aeb83
tree6a8690f33ae9c0bab6ff6e1a7666861068eed116
parenta9c1f0258e221bd0721a99416984dc81cc27fdbd
seq: use safer way to copy strings

The call of strncpy can results in destination buffer without null as
terminator in the case of truncation. Compiler reports the risk as
warnings, like:

In function ‘strncpy’,
    inlined from ‘alsaseq_get_queue_info_by_name’ at ../src/seq/query.c:670:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: warning: ‘strncpy’ specified bound 64 equals destination size [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   96 |       __glibc_objsize (__dest));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~

This commit uses safer way to copy strings, g_strlcpy(), to fix the bug.

Fixes: 4e8675f631ce ("seq: client_info: add properties and accessor methods")
Fixes: f3457eaf706b ("seq: port_info: add properties")
Fixes: 1eabdf6bc647 ("seq: add global method to get the information of queue")
Fixes: f26342b3ab3d ("seq: queue_info: add properties and constructors")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/client-info.c
src/seq/port-info.c
src/seq/query.c
src/seq/queue-info.c