]> git.ipfire.org Git - thirdparty/shadow.git/commit
Overhaul valid_field()
authorChristian Göttsche <cgzones@googlemail.com>
Fri, 31 Mar 2023 12:46:50 +0000 (14:46 +0200)
committerSerge Hallyn <serge@hallyn.com>
Fri, 31 Mar 2023 14:53:40 +0000 (09:53 -0500)
commit2eaea70111f65b16d55998386e4ceb4273c19eb4
tree230f97c966933bba177f77f994d3c2f3eef39a7d
parenta5f9ef8b7fa7dd108270459325092a2be3847331
Overhaul valid_field()

e5905c4b ("Added control character check") introduced checking for
control characters but had the logic inverted, so it rejects all
characters that are not control ones.

Cast the character to `unsigned char` before passing to the character
checking functions to avoid UB.

Use strpbrk(3) for the illegal character test and return early.
lib/fields.c