ShellPkg/UefiHandleParsingLib: support handle list growth

Refactor GetHandleListByProtocol() to support
additions to the handle list during its execution.
Replace LocateHandle() with LocateHandleBuffer() to
avoid the possibility that the buffer allocated for
LocateHandle() is too small if additional handles
are added during GetHandleListByProtocol() execution.

Note that the previous implementation did not detect
the handle list growth and would cause memory
corruption when writing the terminating NULL handle
to the allocated buffer.

Signed-off-by: Bob Morgan <bobm@nvidia.com>
1 file changed