mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-12 14:20:13 +00:00
(__getdate_r): Add extra access check.
This commit is contained in:
parent
294eccacf8
commit
407d349509
@ -23,6 +23,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define TM_YEAR_BASE 1900
|
#define TM_YEAR_BASE 1900
|
||||||
@ -123,6 +124,9 @@ __getdate_r (const char *string, struct tm *tp)
|
|||||||
if (!S_ISREG (st.st_mode))
|
if (!S_ISREG (st.st_mode))
|
||||||
return 4;
|
return 4;
|
||||||
|
|
||||||
|
if (__access (datemsk, R_OK) < 0)
|
||||||
|
return 2;
|
||||||
|
|
||||||
/* Open the template file. */
|
/* Open the template file. */
|
||||||
fp = fopen (datemsk, "r");
|
fp = fopen (datemsk, "r");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user