diff options
| author | Warner Losh <imp@FreeBSD.org> | 1998-09-16 04:17:47 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 1998-09-16 04:17:47 +0000 |
| commit | e8420087b0ae4a2d0611cd2f6413d150cfc83554 (patch) | |
| tree | 69de0b126d131ecd617d41b6eba03770319d92e3 /lib/libc/stdtime/localtime.c | |
| parent | e9363917832d4d492df8463833be0cd952076fa8 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdtime/localtime.c')
| -rw-r--r-- | lib/libc/stdtime/localtime.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index 792815779504a..ad227cf320291 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -273,6 +273,11 @@ register struct state * const sp; register int i; register int fid; + /* XXX The following is from OpenBSD, and I'm not sure it is correct */ + if (name != NULL && issetugid() != 0) + if ((name[0] == ':' && name[1] == '/') || + name[0] == '/' || strchr(name, '.')) + name = NULL; if (name == NULL && (name = TZDEFAULT) == NULL) return -1; { @@ -293,7 +298,7 @@ register struct state * const sp; if (!doaccess) { if ((p = TZDIR) == NULL) return -1; - if ((strlen(p) + strlen(name) + 1) >= sizeof fullname) + if ((strlen(p) + 1 + strlen(name) + 1) >= sizeof fullname) return -1; (void) strcpy(fullname, p); (void) strcat(fullname, "/"); @@ -306,7 +311,7 @@ register struct state * const sp; name = fullname; } if (doaccess && access(name, R_OK) != 0) - return -1; + return -1; if ((fid = open(name, OPEN_MODE)) == -1) return -1; if ((fstat(fid, &stab) < 0) || !S_ISREG(stab.st_mode)) |
