Paul Skirrow
authored
OS_ReadVarVal. Detail: getenv calls OS_ReadVarVal to read a system variable into a buffer. If the buffer is not big enough it increases the size of the buffer by 256 bytes and tries again. However, the first time it was called, it would have no buffer and would call OS_ReadVarVal with r2=-1. The PRM says this "may" return an error which should be ignored, but if it did not return an error then getenv would not allocate a buffer and the call would fail. This change allocates a 256 byte buffer before OS_ReadVarVal is called. Admin: Untested. Version 5.20. Tagged as 'RISC_OSLib-5_20'