nss-mymachines: do not allow overlong machine names

https://github.com/systemd/systemd/issues/2002
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2015-11-23 13:59:43 -05:00
parent 681c8d81bd
commit cb31827d62
1 changed files with 6 additions and 0 deletions

View File

@ -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;