diff options
author | Pavel Březina <pbrezina@redhat.com> | 2012-10-11 10:37:38 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-10-11 12:26:55 +0200 |
commit | 89b93a44d1ce24ec208ee244f7e5b1689fc6ff1a (patch) | |
tree | e04c542214e0a2d1346e964665c83c22f9eb823e | |
parent | 20ae5925d2963937dfc6a66017c05bb018cedd3f (diff) | |
download | sssd-89b93a44d1ce24ec208ee244f7e5b1689fc6ff1a.tar.gz sssd-89b93a44d1ce24ec208ee244f7e5b1689fc6ff1a.tar.bz2 sssd-89b93a44d1ce24ec208ee244f7e5b1689fc6ff1a.zip |
nss_cmd_retpwent(): do not go into infinite loop if n < 0
https://fedorahosted.org/sssd/ticket/1551
-rw-r--r-- | src/responder/nss/nsssrv_cmd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 370c3d29..26a34736 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -1618,6 +1618,14 @@ static int nss_cmd_retpwent(struct cli_ctx *cctx, int num) if (!n) break; + if (n < 0) { + DEBUG(SSSDBG_CRIT_FAILURE, ("BUG: Negative difference" + "[%d - %d = %d]\n", pdom->res->count, cctx->pwent_cur, n)); + DEBUG(SSSDBG_CRIT_FAILURE, ("Domain: %d (total %d)\n", + cctx->pwent_dom_idx, pctx->num)); + break; + } + if (n > num) n = num; msgs = &(pdom->res->msgs[cctx->pwent_cur]); |