netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] netfilter: refactor deprecated strncpy
@ 2023-08-08 22:48 Justin Stitt
  2023-08-08 22:48 ` [PATCH 1/7] netfilter: ipset: " Justin Stitt
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Justin Stitt @ 2023-08-08 22:48 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-hardening, Kees Cook, netfilter-devel, coreteam, netdev,
	linux-kernel, Justin Stitt

`strncpy` is deprecated for use on NUL-terminated destination strings [1].

A suitable replacement is `strscpy` [2] due to the fact that it
guarantees NUL-termination on its destination buffer argument which is
_not_ the case for `strncpy`!

This series of patches aims to swap out `strncpy` for more robust and
less ambiguous interfaces like `strscpy` and `strtomem`. This patch
series, if applied in its entirety, removes most if not all instances of
`strncpy` in the `net/netfilter` directory.

[1]: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[2]: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html

Link: https://github.com/KSPP/linux/issues/90
---
Justin Stitt (7):
      netfilter: ipset: refactor deprecated strncpy
      netfilter: nf_tables: refactor deprecated strncpy
      netfilter: nf_tables: refactor deprecated strncpy
      netfilter: nft_meta: refactor deprecated strncpy
      netfilter: nft_osf: refactor deprecated strncpy to strscpy
      netfilter: x_tables: refactor deprecated strncpy
      netfilter: xtables: refactor deprecated strncpy

 net/netfilter/ipset/ip_set_core.c | 10 +++++-----
 net/netfilter/nft_ct.c            |  2 +-
 net/netfilter/nft_fib.c           |  2 +-
 net/netfilter/nft_meta.c          |  6 +++---
 net/netfilter/nft_osf.c           |  6 +++---
 net/netfilter/x_tables.c          |  5 ++---
 net/netfilter/xt_repldata.h       |  2 +-
 7 files changed, 16 insertions(+), 17 deletions(-)
---
base-commit: 14f9643dc90adea074a0ffb7a17d337eafc6a5cc
change-id: 20230807-net-netfilter-4027219bb6e7

Best regards,
--
Justin Stitt <justinstitt@google.com>


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-08-09  0:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 22:48 [PATCH 0/7] netfilter: refactor deprecated strncpy Justin Stitt
2023-08-08 22:48 ` [PATCH 1/7] netfilter: ipset: " Justin Stitt
2023-08-08 23:38   ` Florian Westphal
2023-08-09  0:00     ` Kees Cook
2023-08-08 22:48 ` [PATCH 2/7] netfilter: nf_tables: " Justin Stitt
2023-08-08 23:40   ` Florian Westphal
2023-08-09  0:41     ` Justin Stitt
2023-08-08 22:48 ` [PATCH 3/7] " Justin Stitt
2023-08-08 23:13   ` Florian Westphal
2023-08-08 22:48 ` [PATCH 4/7] netfilter: nft_meta: " Justin Stitt
2023-08-08 22:48 ` [PATCH 5/7] netfilter: nft_osf: refactor deprecated strncpy to strscpy Justin Stitt
2023-08-08 22:48 ` [PATCH 6/7] netfilter: x_tables: refactor deprecated strncpy Justin Stitt
2023-08-08 23:57   ` Florian Westphal
2023-08-09  0:04   ` Kees Cook
2023-08-08 22:48 ` [PATCH 7/7] netfilter: xtables: " Justin Stitt
2023-08-08 23:20   ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).