pull up r25444 from trunk
authorTom Yu <tlyu@mit.edu>
Tue, 8 Nov 2011 22:21:36 +0000 (22:21 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 8 Nov 2011 22:21:36 +0000 (22:21 +0000)
 ------------------------------------------------------------------------
 r25444 | ghudson | 2011-11-06 00:32:34 -0500 (Sun, 06 Nov 2011) | 10 lines

 ticket: 7003
 subject: Fix month/year units in getdate
 target_version: 1.10
 tags: pullup

 getdate strings like "1 month" or "next year" would fail some of the
 time, depending on the value of stack garbage, because DSTcorrect()
 doesn't set *error on success and RelativeMonth() doesn't initialize
 error.  Make DSTcorrect() responsible for setting *error in all cases.

ticket: 7012
version_fixed: 1.8.6
status: resolved

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-8@25464 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/cli/getdate.y

index 6ea75eb08d41f98220204d2971ed55f29741f20d..4372ad50a6e402c2a42afdd3c3a2dbc577c30784 100644 (file)
@@ -646,6 +646,7 @@ DSTcorrect(Start, Future, error)
        return -1;
     }
     FutureDay = (tm->tm_hour + 1) % 24;
+    *error = 0;
     return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
 }
 
@@ -896,7 +897,7 @@ get_date(p)
     time_t             Start;
     time_t             tod;
     time_t             delta;
-    int                        error = 0;
+    int                        error;
 
     yyInput = p;
     if (now == NULL) {