From: Benjamin Kaduk Date: Wed, 14 Jan 2015 02:39:57 +0000 (-0500) Subject: pts: add some sanity checks in ptuser.c X-Git-Tag: openafs-stable-1_8_0pre1~6 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=f413fd927af14a9a87034e47125a78eec63e599e 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 --- 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);