Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/time PR/49284: Andreas Gustafsson: sysinst segfault...
details: https://anonhg.NetBSD.org/src/rev/53c9d1f00d98
branches: trunk
changeset: 333036:53c9d1f00d98
user: christos <christos%NetBSD.org@localhost>
date: Wed Oct 15 15:13:45 2014 +0000
description:
PR/49284: Andreas Gustafsson: sysinst segfaults when configuring network
manually. When tzload() fails called from zoneinit(), when trying to set the
local timezone for the first time in tzsetlcl(), we end up with a lclptr
that contains garbage, so settzname() core-dumps.
Thanks Andreas for the analysis!
diffstat:
lib/libc/time/localtime.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (36 lines):
diff -r 862fd783bc6a -r 53c9d1f00d98 lib/libc/time/localtime.c
--- a/lib/libc/time/localtime.c Wed Oct 15 15:00:03 2014 +0000
+++ b/lib/libc/time/localtime.c Wed Oct 15 15:13:45 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: localtime.c,v 1.88 2014/10/14 20:35:40 christos Exp $ */
+/* $NetBSD: localtime.c,v 1.89 2014/10/15 15:13:45 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
#if 0
static char elsieid[] = "@(#)localtime.c 8.17";
#else
-__RCSID("$NetBSD: localtime.c,v 1.88 2014/10/14 20:35:40 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.89 2014/10/15 15:13:45 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -1237,9 +1237,14 @@
if (0 < lcl)
(void)strcpy(lcl_TZname, name);
- if (! lclptr)
- lclptr = malloc(sizeof *lclptr);
- zoneinit(lclptr, name);
+ if (! lclptr) {
+ struct state *sp = malloc(sizeof *lclptr);
+ if (!zoneinit(sp, name)) {
+ free(sp);
+ return;
+ }
+ lclptr = sp;
+ }
settzname();
lcl_is_set = lcl;
}
Home |
Main Index |
Thread Index |
Old Index