Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XrdOucUtils::GroupName not properly checking return value of getgrgid_r #51

Closed
mgmarino opened this issue Oct 23, 2013 · 0 comments · Fixed by #52
Closed

XrdOucUtils::GroupName not properly checking return value of getgrgid_r #51

mgmarino opened this issue Oct 23, 2013 · 0 comments · Fixed by #52

Comments

@mgmarino
Copy link
Contributor

There are 2 issues:

  1. The code is currently checking if "errno" is == ERANGE, but getgrgid_r is thread safe and returns the error code.
  2. Even if getgrgid_r succeeds, the code needs to check the value of gEnt since it may be NULL.

From http://pubs.opengroup.org/onlinepubs/009695299/functions/getgrgid.html

int getgrgid_r(gid_t gid, struct group _grp, char *buffer,
size_t bufsize, struct group *_result);
...
The getgrgid_r() function shall update the group structure pointed to by grp and store a pointer to that structure at the location pointed to by result.... A NULL pointer shall be returned at the location pointed to by result on error or if the requested entry is not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant