Skip to content

Commit

Permalink
nss-mymachines: do not allow overlong machine names
Browse files Browse the repository at this point in the history
  • Loading branch information
keszybz committed Nov 23, 2015
1 parent 681c8d8 commit cb31827
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/nss-mymachines/nss-mymachines.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit cb31827

Please sign in to comment.