]> git.ipfire.org Git - thirdparty/util-linux.git/commit
write: fix potential string overflow
authorSami Kerola <kerolasa@iki.fi>
Sat, 8 Feb 2020 21:12:14 +0000 (21:12 +0000)
committerKarel Zak <kzak@redhat.com>
Fri, 15 May 2020 10:52:37 +0000 (12:52 +0200)
commit62e978dbf7bec21888f8cb4f881d23389c8f9ed6
treeb0cfd90ecfd2cc27fcb1ee55c3478746f5adfe00
parent1c0b61ab78ad93e84d89f1f169bae19c6319bb76
write: fix potential string overflow

Noticed when compiled with gcc verion 9.2.1 20200130.

term-utils/write.c:182:7: warning: ‘strcmp’ argument 1 declared attribute
  ‘nonstring’ [-Wstringop-overflow=]
  182 |   if (strcmp(u->ut_line, ctl->src_tty_name) == 0) {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/utmpx.h:31,
                 from term-utils/write.c:60:
/usr/include/bits/utmpx.h:59:8: note: argument ‘ut_line’ declared here
   59 |   char ut_line[__UT_LINESIZE]
      |        ^~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
term-utils/write.c