diff options
| author | Garrett Wollman <wollman@FreeBSD.org> | 1996-10-09 17:39:37 +0000 | 
|---|---|---|
| committer | Garrett Wollman <wollman@FreeBSD.org> | 1996-10-09 17:39:37 +0000 | 
| commit | 318a4f9fc375c9018acbf187685d279337ee0dae (patch) | |
| tree | b81206bfc6349a8c2e3103482d16f16cf74405cb /lib/libc/stdtime/localtime.c | |
| parent | 7c99d4740c4802de3a1b70d6bf4737566669f837 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdtime/localtime.c')
| -rw-r--r-- | lib/libc/stdtime/localtime.c | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index ae302ec83fd9..5774354edf1e 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -17,6 +17,9 @@ static char	elsieid[] = "@(#)localtime.c	7.57";  /*LINTLIBRARY*/ +#include <sys/types.h> +#include <sys/stat.h> +  #include "private.h"  #include "tzfile.h"  #include "fcntl.h" @@ -274,10 +277,11 @@ register struct state * const	sp;  		return -1;  	{  		register int	doaccess; +		struct stat	stab;  		/*  		** Section 4.9.1 of the C standard says that  		** "FILENAME_MAX expands to an integral constant expression -		** that is the sie needed for an array of char large enough +		** that is the size needed for an array of char large enough  		** to hold the longest file name string that the implementation  		** guarantees can be opened."  		*/ @@ -305,6 +309,8 @@ register struct state * const	sp;  			return -1;  		if ((fid = open(name, OPEN_MODE)) == -1)  			return -1; +		if ((fstat(fid, &stab) < 0) || !S_ISREG(stab.st_mode)) +			return -1;  	}  	{  		struct tzhead *	tzhp; | 
