diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-11-23 13:59:43 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-11-23 13:59:43 -0500 |
commit | cb31827d62066a04b02111df3052949fda4b6888 (patch) | |
tree | c3ba78ff582bf9ff3426a904c003b165ea62e711 /src/nss-mymachines | |
parent | 681c8d81bdc946360d13185632d1920ffaeb5ad9 (diff) |
nss-mymachines: do not allow overlong machine names
https://github.com/systemd/systemd/issues/2002
Diffstat (limited to 'src/nss-mymachines')
-rw-r--r-- | src/nss-mymachines/nss-mymachines.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c index 969fa9619e..c98a959b3b 100644 --- a/src/nss-mymachines/nss-mymachines.c +++ b/src/nss-mymachines/nss-mymachines.c @@ -416,6 +416,9 @@ enum nss_status _nss_mymachines_getpwnam_r( if (!e || e == p) goto not_found; + if (e - p > HOST_NAME_MAX - 1) /* -1 for the last dash */ + goto not_found; + r = parse_uid(e + 1, &uid); if (r < 0) goto not_found; @@ -573,6 +576,9 @@ enum nss_status _nss_mymachines_getgrnam_r( if (!e || e == p) goto not_found; + if (e - p > HOST_NAME_MAX - 1) /* -1 for the last dash */ + goto not_found; + r = parse_gid(e + 1, &gid); if (r < 0) goto not_found; |