From f413fd927af14a9a87034e47125a78eec63e599e Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Tue, 13 Jan 2015 21:39:57 -0500 Subject: [PATCH] pts: add some sanity checks in ptuser.c Double-check that when we're expecting two entries back, we actually got two entries, in addition to the RPC return value. Change-Id: I34631ac542667c337ed3268153eb61c70e3fa87e Reviewed-on: https://gerrit.openafs.org/11668 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/ptserver/ptuser.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ptserver/ptuser.c b/src/ptserver/ptuser.c index 6296cb4..7df9291 100644 --- a/src/ptserver/ptuser.c +++ b/src/ptserver/ptuser.c @@ -444,6 +444,10 @@ pr_AddToGroup(prname user, prname group) if (code) goto done; /* if here, still could be missing an entry */ + if (lids.idlist_len != 2) { + code = PRINTERNAL; + goto done; + } if (lids.idlist_val[0] == ANONYMOUSID || lids.idlist_val[1] == ANONYMOUSID) { code = PRNOENT; @@ -483,6 +487,10 @@ pr_RemoveUserFromGroup(prname user, prname group) if (code) goto done; + if (lids.idlist_len != 2) { + code = PRINTERNAL; + goto done; + } if (lids.idlist_val[0] == ANONYMOUSID || lids.idlist_val[1] == ANONYMOUSID) { code = PRNOENT; @@ -988,6 +996,11 @@ pr_IsAMemberOf(prname uname, prname gname, afs_int32 *flag) xdr_free((xdrproc_t) xdr_idlist, &lids); return code; } + if (lids.idlist_len != 2) { + free(lnames.namelist_val); + xdr_free((xdrproc_t) xdr_idlist, &lids); + return PRINTERNAL; + } code = ubik_PR_IsAMemberOf(pruclient, 0, lids.idlist_val[0], lids.idlist_val[1], flag); -- 1.9.4