mirror of https://github.com/acpica/acpica/
MacOSX: Remove deprecated tmpnam call for OS X
The following build errors can be seen for MacOSX builds: .../osunixxf.c:829:42: error: 'tmpnam' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead. [-Werror,-Wdeprecated-declarations] tmpnam should NOT be used and provides an easy and obvious privilege escalation attack point. There is no advantage or compatibility reason to use this function on OS X, and it correctly throws an error if its use is attempted. Simply replacing it with mktemp, which behaves identically to tmpnam, only with responsible protection against interprocess attacks. It will behave identically if given NULL, and will fail in exactly the same way, so there is no danger in switching to this function. It's also safely tucked away in a specific #ifdef __APPLE__ block anyway, so the scope of this change is perfectly controlled. Signed-off-by: metacollin <metacollin@gmail.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
This commit is contained in:
parent
d14099ff86
commit
01eb9a58f4
|
@ -826,7 +826,7 @@ AcpiOsCreateSemaphore (
|
|||
|
||||
#ifdef __APPLE__
|
||||
{
|
||||
char *SemaphoreName = tmpnam (NULL);
|
||||
char *SemaphoreName = mktemp (NULL);
|
||||
|
||||
Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits);
|
||||
if (!Sem)
|
||||
|
|
Loading…
Reference in New Issue