emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 852111f3: Fix lifetime bug in tzlookup


From: Paul Eggert
Subject: [Emacs-diffs] master 852111f3: Fix lifetime bug in tzlookup
Date: Wed, 20 Jul 2016 21:38:49 +0000 (UTC)

branch: master
commit 852111f3a6640d61ea1a1b2fd0cbf50623642927
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix lifetime bug in tzlookup
    
    * src/editfns.c (tzlookup): Fix storage lifetime bug when
    INTEGERP (zone) && settz.  Problem found by Coverity Scan.
---
 src/editfns.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/editfns.c b/src/editfns.c
index aed884e..61b2a87 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -146,6 +146,9 @@ xtzfree (timezone_t tz)
 static timezone_t
 tzlookup (Lisp_Object zone, bool settz)
 {
+  static char const tzbuf_format[] = "<%+.*"pI"d>%s%"pI"d:%02d:%02d";
+  char const *trailing_tzbuf_format = tzbuf_format + sizeof "<%+.*"pI"d" - 1;
+  char tzbuf[sizeof tzbuf_format + 2 * INT_STRLEN_BOUND (EMACS_INT)];
   char const *zone_string;
   timezone_t new_tz;
 
@@ -158,9 +161,6 @@ tzlookup (Lisp_Object zone, bool settz)
     }
   else
     {
-      static char const tzbuf_format[] = "<%+.*"pI"d>%s%"pI"d:%02d:%02d";
-      char const *trailing_tzbuf_format = tzbuf_format + sizeof "<%+.*"pI"d" - 
1;
-      char tzbuf[sizeof tzbuf_format + 2 * INT_STRLEN_BOUND (EMACS_INT)];
       bool plain_integer = INTEGERP (zone);
 
       if (EQ (zone, Qwall))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]