aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2016-07-20 23:38:12 +0200
committerPaul Eggert2016-07-20 23:38:44 +0200
commit852111f3a6640d61ea1a1b2fd0cbf50623642927 (patch)
tree90e4ac9c12f9def59e15c0c84f1184512b10ae3b /src
parent90fb0b2d13d0f44ecb9606587681cb4d8a6f0225 (diff)
downloademacs-852111f3a6640d61ea1a1b2fd0cbf50623642927.tar.gz
emacs-852111f3a6640d61ea1a1b2fd0cbf50623642927.zip
Fix lifetime bug in tzlookup
* src/editfns.c (tzlookup): Fix storage lifetime bug when INTEGERP (zone) && settz. Problem found by Coverity Scan.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/editfns.c b/src/editfns.c
index aed884ebe1c..61b2a871b73 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -146,6 +146,9 @@ xtzfree (timezone_t tz)
146static timezone_t 146static timezone_t
147tzlookup (Lisp_Object zone, bool settz) 147tzlookup (Lisp_Object zone, bool settz)
148{ 148{
149 static char const tzbuf_format[] = "<%+.*"pI"d>%s%"pI"d:%02d:%02d";
150 char const *trailing_tzbuf_format = tzbuf_format + sizeof "<%+.*"pI"d" - 1;
151 char tzbuf[sizeof tzbuf_format + 2 * INT_STRLEN_BOUND (EMACS_INT)];
149 char const *zone_string; 152 char const *zone_string;
150 timezone_t new_tz; 153 timezone_t new_tz;
151 154
@@ -158,9 +161,6 @@ tzlookup (Lisp_Object zone, bool settz)
158 } 161 }
159 else 162 else
160 { 163 {
161 static char const tzbuf_format[] = "<%+.*"pI"d>%s%"pI"d:%02d:%02d";
162 char const *trailing_tzbuf_format = tzbuf_format + sizeof "<%+.*"pI"d" - 1;
163 char tzbuf[sizeof tzbuf_format + 2 * INT_STRLEN_BOUND (EMACS_INT)];
164 bool plain_integer = INTEGERP (zone); 164 bool plain_integer = INTEGERP (zone);
165 165
166 if (EQ (zone, Qwall)) 166 if (EQ (zone, Qwall))