summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-09 19:21:42 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-09 19:22:13 +0200
commit38c74dad1c3d605018e61074e0b80f6b9523b1c8 (patch)
tree4e67b34fba0e0fbf89fc16b6190775d993e7526c
parent932ad62b84165b0acf690ea34c4b8083657ae244 (diff)
sysusers: don't allow control characters in gecos fields
-rw-r--r--src/sysusers/sysusers.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 40a669725e..129493a1e7 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -1107,7 +1107,11 @@ static bool valid_gecos(const char *d) {
if (!utf8_is_valid(d))
return false;
- if (strpbrk(d, ":\n"))
+ if (string_has_cc(d, NULL))
+ return false;
+
+ /* Colons are used as field separators, and hence not OK */
+ if (strchr(d, ':'))
return false;
return true;