aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdtime
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>1998-09-16 04:17:47 +0000
committerWarner Losh <imp@FreeBSD.org>1998-09-16 04:17:47 +0000
commite8420087b0ae4a2d0611cd2f6413d150cfc83554 (patch)
tree69de0b126d131ecd617d41b6eba03770319d92e3 /lib/libc/stdtime
parente9363917832d4d492df8463833be0cd952076fa8 (diff)
Notes
Diffstat (limited to 'lib/libc/stdtime')
-rw-r--r--lib/libc/stdtime/localtime.c9
-rw-r--r--lib/libc/stdtime/timelocal.c4
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c
index 792815779504..ad227cf32029 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))
diff --git a/lib/libc/stdtime/timelocal.c b/lib/libc/stdtime/timelocal.c
index ef40035c09f4..31f0340c4187 100644
--- a/lib/libc/stdtime/timelocal.c
+++ b/lib/libc/stdtime/timelocal.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: timelocal.c,v 1.1 1997/08/09 15:43:57 joerg Exp $
*/
#include <sys/types.h>
@@ -146,7 +146,7 @@ __time_load_locale(const char *name)
bufsize = namesize + st.st_size;
locale_buf = NULL;
lbuf = (lbuf == NULL || lbuf == locale_buf_C) ?
- malloc(bufsize) : realloc(lbuf, bufsize);
+ malloc(bufsize) : reallocf(lbuf, bufsize);
if (lbuf == NULL)
goto bad_locale;
(void) strcpy(lbuf, name);