diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-06-05 15:41:46 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-06-05 15:52:20 +0200 |
commit | c110e664af9449e8fac24f4ed6e973d98d4fd268 (patch) | |
tree | 50101ca75216eba025b74b77ad1e33184219e625 | |
parent | 613c8acbdd93210b40ec6fa48cbbf297a061b3cc (diff) | |
download | samba-c110e664af9449e8fac24f4ed6e973d98d4fd268.tar.gz samba-c110e664af9449e8fac24f4ed6e973d98d4fd268.tar.bz2 samba-c110e664af9449e8fac24f4ed6e973d98d4fd268.zip |
nss_wrapper: fix segfault in nwrap_gr_copy_r()
metze
-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); |