diff options
-rw-r--r-- | lib/nss_wrapper/nss_wrapper.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c index 7b67e695d6..317c251a24 100644 --- a/lib/nss_wrapper/nss_wrapper.c +++ b/lib/nss_wrapper/nss_wrapper.c @@ -816,7 +816,7 @@ static int nwrap_gr_copy_r(const struct group *src, struct group *dst, { char *first; char **lastm; - char *last; + char *last = NULL; off_t ofsb; off_t ofsm; off_t ofs; @@ -825,9 +825,14 @@ static int nwrap_gr_copy_r(const struct group *src, struct group *dst, first = src->gr_name; lastm = src->gr_mem; - while (*lastm) lastm++; + while (*lastm) { + last = *lastm; + lastm++; + } - last = *lastm; + if (last == NULL) { + last = src->gr_passwd; + } while (*last) last++; ofsb = PTR_DIFF(last + 1, first); |