Sync with NetBSD, mainly address NetBSD bug #43355:

Fix valid_format() to be more careful about allowing only valid
printf formats.

Obtained from:	NetBSD
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@275918 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f