]> 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)
committerSami Kerola <kerolasa@iki.fi>
Sat, 15 Feb 2020 15:23:36 +0000 (15:23 +0000)
commitcdf84bf65804873708b2b76551d64116123ac128
treef9ba577f88acd649b17b20488f3bf2fa591c4e31
parent3239663361b9b009d7bf99f1529d60a18a1ea9d7
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