Applications that are using elevated access rights (including setuid
and setgid
access rights flags on Unix), special care needs to be taken.
One issue that needs to be protected is RDM use of environment variables. There are the environment variables used by RDM:
Such applications should therefore unset these environment variables prior to using the RDM API.
On Unix include the following code:
unsetenv ("RDM_DOCROOT"); unsetenv ("RDM_TMPDIR"); unsetenv ("TMPDIR");
On Windows include the following code:
SetEnvironmentVariable("RDM_DOCROOT", NULL); SetEnvironmentVariable("RDM_TMPDIR", NULL); SetEnvironmentVariable("TEMP", NULL); SetEnvironmentVariable("TMP", NULL);
An alternative to the above approach is to explicitly set it to something that can be trusted or check what it has been set to something safe.
If the environment variables for the temporary directory is not set, the sub-directory 'temp' of the Windows directory returned by GetWindowsDirectory()
will be used on Windows, and /tmp
will be used on Unix.