bozo: Return BZDOM when BOZO_EnumerateInstance index is negative

The BOZO_EnumerateInstance looks up a bnode instance with a zero-based
index (anum) and returns BZDOM when the index is out of range for the
current list of bosserver bnode instances.

The index is defined as a signed integer by the RPC, but the implementation
does not check for a negative index.  Currently, the implementation
returns an empty string when a negative (out of range) index is given.

Instead, return a BZDOM error to indicate the index is out of range.

Commit ea276e83e37e5bd27285a3d639f2158639172786 (OPENAFS-SA-2019-001:
Skip server OUT args on error) is a prerequisite for this change.

Change-Id: I4df5d35aaccdbfcbe8e8dcc4fa1aa45ee06b06ab
Reviewed-on: https://gerrit.openafs.org/15031
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Michael Meffie 2022-06-08 09:03:32 -04:00 committed by Benjamin Kaduk
parent 61c391bf7c
commit 6c7c9f781b

View File

@ -1244,6 +1244,9 @@ SBOZO_EnumerateInstance(struct rx_call *acall, afs_int32 anum,
{
struct eidata tdata;
if (anum < 0)
return BZDOM;
*ainstance = malloc(BOZO_BSSIZE);
**ainstance = 0;
tdata.counter = anum;