apply the patch suggested here:
https://savannah.cern.ch/bugs/index.php?99968


git-svn-id: https://root.cern.ch/svn/root/trunk@48368 27541ba8-7e3a-0410-8455-c3a389f83636
We use HAVE_UNISTD_H, so #include config.h which defines it.


git-svn-id: https://root.cern.ch/svn/root/trunk@48369 27541ba8-7e3a-0410-8455-c3a389f83636
Add a couple of protections against potential invalid values (negative index and null pointer)


git-svn-id: https://root.cern.ch/svn/root/trunk@48371 27541ba8-7e3a-0410-8455-c3a389f83636