~ubuntu-branches/ubuntu/lucid/curl/lucid-security

« back to all changes in this revision

Viewing changes to lib/parsedate.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-12-12 15:04:52 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20051212150452-2ymlra67b2p7kjyy
Tags: 7.15.1-1ubuntu1
Resynchronise with Debian to get URL parser overflow fix from 7.15.1
(CVE-2005-4077).

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: parsedate.c,v 1.16 2005/04/26 13:08:49 bagder Exp $
 
21
 * $Id: parsedate.c,v 1.19 2005/10/04 18:15:33 bagder Exp $
22
22
 ***************************************************************************/
23
23
/*
24
24
  A brief summary of the date string formats this parser groks:
102
102
 
103
103
/* Here's a bunch of frequently used time zone names. These were supported
104
104
   by the old getdate parser. */
 
105
#define tDAYZONE -60       /* offset for daylight savings time */
105
106
static const struct tzinfo tz[]= {
106
 
  {"GMT", 0},     /* Greenwich Mean */
107
 
  {"UTC", 0},     /* Universal (Coordinated) */
108
 
  {"WET", 0},     /* Western European */
109
 
  {"BST", 0},     /* British Summer */
110
 
  {"WAT", 60},    /* West Africa */
111
 
  {"AST", 240},   /* Atlantic Standard */
112
 
  {"ADT", 240},   /* Atlantic Daylight */
113
 
  {"EST", 300},   /* Eastern Standard */
114
 
  {"EDT", 300},   /* Eastern Daylight */
115
 
  {"CST", 360},   /* Central Standard */
116
 
  {"CDT", 360},   /* Central Daylight */
117
 
  {"MST", 420},   /* Mountain Standard */
118
 
  {"MDT", 420},   /* Mountain Daylight */
119
 
  {"PST", 480},   /* Pacific Standard */
120
 
  {"PDT", 480},   /* Pacific Daylight */
121
 
  {"YST", 540},   /* Yukon Standard */
122
 
  {"YDT", 540},   /* Yukon Daylight */
123
 
  {"HST", 600},   /* Hawaii Standard */
124
 
  {"HDT", 600},   /* Hawaii Daylight */
125
 
  {"CAT", 600},   /* Central Alaska */
126
 
  {"AHST", 600},  /* Alaska-Hawaii Standard */
127
 
  {"NT",  660},   /* Nome */
128
 
  {"IDLW", 720},  /* International Date Line West */
129
 
  {"CET", -60},   /* Central European */
130
 
  {"MET", -60},   /* Middle European */
131
 
  {"MEWT", -60},  /* Middle European Winter */
132
 
  {"MEST", -120}, /* Middle European Summer */
133
 
  {"CEST", -120}, /* Central European Summer */
134
 
  {"MESZ", -60},  /* Middle European Summer */
135
 
  {"FWT", -60},   /* French Winter */
136
 
  {"FST", -60},   /* French Summer */
137
 
  {"EET", -120},  /* Eastern Europe, USSR Zone 1 */
138
 
  {"WAST", -420}, /* West Australian Standard */
139
 
  {"WADT", -420}, /* West Australian Daylight */
140
 
  {"CCT", -480},  /* China Coast, USSR Zone 7 */
141
 
  {"JST", -540},  /* Japan Standard, USSR Zone 8 */
142
 
  {"EAST", -600}, /* Eastern Australian Standard */
143
 
  {"EADT", -600}, /* Eastern Australian Daylight */
144
 
  {"GST", -600},  /* Guam Standard, USSR Zone 9 */
145
 
  {"NZT", -720},  /* New Zealand */
146
 
  {"NZST", -720}, /* New Zealand Standard */
147
 
  {"NZDT", -720}, /* New Zealand Daylight */
148
 
  {"IDLE", -720}, /* International Date Line East */
 
107
  {"GMT", 0},              /* Greenwich Mean */
 
108
  {"UTC", 0},              /* Universal (Coordinated) */
 
109
  {"WET", 0},              /* Western European */
 
110
  {"BST", 0 tDAYZONE},     /* British Summer */
 
111
  {"WAT", 60},             /* West Africa */
 
112
  {"AST", 240},            /* Atlantic Standard */
 
113
  {"ADT", 240 tDAYZONE},   /* Atlantic Daylight */
 
114
  {"EST", 300},            /* Eastern Standard */
 
115
  {"EDT", 300 tDAYZONE},   /* Eastern Daylight */
 
116
  {"CST", 360},            /* Central Standard */
 
117
  {"CDT", 360 tDAYZONE},   /* Central Daylight */
 
118
  {"MST", 420},            /* Mountain Standard */
 
119
  {"MDT", 420 tDAYZONE},   /* Mountain Daylight */
 
120
  {"PST", 480},            /* Pacific Standard */
 
121
  {"PDT", 480 tDAYZONE},   /* Pacific Daylight */
 
122
  {"YST", 540},            /* Yukon Standard */
 
123
  {"YDT", 540 tDAYZONE},   /* Yukon Daylight */
 
124
  {"HST", 600},            /* Hawaii Standard */
 
125
  {"HDT", 600 tDAYZONE},   /* Hawaii Daylight */
 
126
  {"CAT", 600},            /* Central Alaska */
 
127
  {"AHST", 600},           /* Alaska-Hawaii Standard */
 
128
  {"NT",  660},            /* Nome */
 
129
  {"IDLW", 720},           /* International Date Line West */
 
130
  {"CET", -60},            /* Central European */
 
131
  {"MET", -60},            /* Middle European */
 
132
  {"MEWT", -60},           /* Middle European Winter */
 
133
  {"MEST", -60 tDAYZONE},  /* Middle European Summer */
 
134
  {"CEST", -60 tDAYZONE},  /* Central European Summer */
 
135
  {"MESZ", -60 tDAYZONE},  /* Middle European Summer */
 
136
  {"FWT", -60},            /* French Winter */
 
137
  {"FST", -60 tDAYZONE},   /* French Summer */
 
138
  {"EET", -120},           /* Eastern Europe, USSR Zone 1 */
 
139
  {"WAST", -420},          /* West Australian Standard */
 
140
  {"WADT", -420 tDAYZONE}, /* West Australian Daylight */
 
141
  {"CCT", -480},           /* China Coast, USSR Zone 7 */
 
142
  {"JST", -540},           /* Japan Standard, USSR Zone 8 */
 
143
  {"EAST", -600},          /* Eastern Australian Standard */
 
144
  {"EADT", -600 tDAYZONE}, /* Eastern Australian Daylight */
 
145
  {"GST", -600},           /* Guam Standard, USSR Zone 9 */
 
146
  {"NZT", -720},           /* New Zealand */
 
147
  {"NZST", -720},          /* New Zealand Standard */
 
148
  {"NZDT", -720 tDAYZONE}, /* New Zealand Daylight */
 
149
  {"IDLE", -720},          /* International Date Line East */
149
150
};
150
151
 
151
152
/* returns:
236
237
  struct tm tm;
237
238
  enum assume dignext = DATE_MDAY;
238
239
  const char *indate = date; /* save the original pointer */
239
 
 
240
240
  int part = 0; /* max 6 parts */
241
241
 
 
242
#ifdef WIN32
 
243
  /*
 
244
   * On Windows, we need an odd work-around for the case when no TZ variable
 
245
   * is set. If it isn't set and "automatic DST adjustment" is enabled, the
 
246
   * time functions below will return values one hour off! As reported and
 
247
   * investigated in bug report #1230118.
 
248
  */
 
249
  const char *env = getenv("TZ");
 
250
  if(!env)
 
251
    putenv("TZ=GMT");
 
252
#endif
 
253
 
242
254
  while(*date && (part < 6)) {
243
255
    bool found=FALSE;
244
256