Commit 36c8eae8 authored by vegaMato's avatar vegaMato Committed by Ludovic Rousseau

Remove usage of function chmod(2) to use fchmod(2)

Race condition possibility; CWE-362: Concurrent Execution using Shared
Resource with Improper Synchronization ('Race Condition')

Thanks to PA193 project
https://github.com/vegaMato/PCSC-lite-project-tasks
parent 43004384
......@@ -685,12 +685,13 @@ int main(int argc, char **argv)
"writing " PCSCLITE_RUN_PID " failed: %s",
strerror(errno));
}
(void)close(f);
/* set mode so that the file is world readable even is umask is
* restrictive
* The file is used by libpcsclite */
(void)chmod(PCSCLITE_RUN_PID, mode);
(void)fchmod(f, mode);
(void)close(f);
}
else
Log2(PCSC_LOG_CRITICAL, "cannot create " PCSCLITE_RUN_PID ": %s",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment