Added check for path length

Added check for sufficient path string length prior
to searching for "/bin" at the end of the path. This
solves exceptions thrown by a number of tests.

Change-Id: Ibefe7356a9f5b0353822258155bba706f1e26f2e