Fix valid_format() to be more careful about allowing only valid printf formats. Obtained from: NetBSD MFC after: 2 weeks
Approved by: bcr (mentor) MFC after: 3 days
Obtained from: NetBSD MFC after: 3 months