ソースを参照

be sure that the RFC1123StrToTime method is run in a LANG=C environment

David Kalnischkies 16 年 前
コミット
24d7b6267e
共有1 個のファイルを変更した6 個の追加2 個の削除を含む
  1. 6 2
      apt-pkg/contrib/strutl.cc

+ 6 - 2
apt-pkg/contrib/strutl.cc

@@ -861,12 +861,16 @@ static time_t timegm(struct tm *t)
 bool RFC1123StrToTime(const char* const str,time_t &time)
 bool RFC1123StrToTime(const char* const str,time_t &time)
 {
 {
    struct tm Tm;
    struct tm Tm;
+   setlocale (LC_ALL,"C");
+   bool const invalid =
    // Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
    // Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
-   if (strptime(str, "%a, %d %b %Y %H:%M:%S %Z", &Tm) == NULL &&
+      (strptime(str, "%a, %d %b %Y %H:%M:%S %Z", &Tm) == NULL &&
    // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
    // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
        strptime(str, "%A, %d-%b-%y %H:%M:%S %Z", &Tm) == NULL &&
        strptime(str, "%A, %d-%b-%y %H:%M:%S %Z", &Tm) == NULL &&
    // Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format
    // Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format
-       strptime(str, "%a %b %d %H:%M:%S %Y", &Tm) == NULL)
+       strptime(str, "%a %b %d %H:%M:%S %Y", &Tm) == NULL);
+   setlocale (LC_ALL,"");
+   if (invalid == true)
       return false;
       return false;
 
 
    time = timegm(&Tm);
    time = timegm(&Tm);