]> git.ozlabs.org Git - ppp.git/commit
pppd: Eliminate some more compiler warnings
authorPaul Mackerras <paulus@ozlabs.org>
Sun, 1 Dec 2019 10:32:37 +0000 (21:32 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Sun, 1 Dec 2019 10:32:37 +0000 (21:32 +1100)
commit3ea9de913739667e2131d67d979ff175ec394e67
tree1771764a5144144828f74013553da4150d0030e9
parent57edb1a0ebf3e25d824b22c75d1d95e0f378f74a
pppd: Eliminate some more compiler warnings

Recent versions of gcc produce warnings on code where strncpy will
produce a result that is not NULL terminated.  This changes the
code to eliminate these warnings.  In two cases this is done by
changing strncpy to strlcpy, which could in principle cause a loss
of the information in the last byte.  This is not a concern in
these cases because:

- In sys-linux.c, the interface names in struct ifreq were possibly
  not NULL terminated.  The Linux kernel clears the last byte to make
  them NULL terminated anyway, so there is no loss of information.

- In session.c, the lastlog ll_line and ll_host fields were possibly
  not NULL terminated.  These fields are quite long and it is unlikely
  that the last byte is needed.

In the other cases strlcpy and strlcat are used to give the same
effect as the old code but without warnings.

This also changes %ld to %d in one place to eliminate a format warning.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pppd/plugins/radius/avpair.c
pppd/plugins/radius/config.c
pppd/plugins/rp-pppoe/plugin.c
pppd/session.c
pppd/sys-linux.c