]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/fields.c: valid_field(): Check empty string before strisprint_c()
authorAlejandro Colomar <alx@kernel.org>
Sat, 3 Jan 2026 13:33:44 +0000 (14:33 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Thu, 11 Jun 2026 07:33:53 +0000 (09:33 +0200)
This allows us to not depend on whether strisprint_c("") returns true or
false.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/fields.c

index af9bed077e4391a884297319235586a9edcf7cc9..6f0d77abc10199236b26c8af6cb5e44da09abe5b 100644 (file)
@@ -45,10 +45,10 @@ valid_field_(const char *field, const char *illegal)
                return -1;
        if (strchriscntrl_c(field))
                return -1;
-       if (strisprint_c(field))
-               return 0;
        if (streq(field, ""))
                return 0;
+       if (strisprint_c(field))
+               return 0;
 
        return 1;  // !ASCII
 }