}
expiration = mutt_get_parameter ("expiration", b->parameter);
- if (expiration)
- {
- /* mutt_parse_date() will alter its argument, so we need a copy */
- char *e = safe_strdup (expiration);
-
- expire = mutt_parse_date (e, NULL);
- free (e);
- }
+ if (expiration)
+ expire = mutt_parse_date (expiration, NULL);
else
expire = -1;
* This routine assumes that `h' has been initialized to 0. the `timezone'
* field is optional, defaulting to +0000 if missing.
*/
-time_t mutt_parse_date (char *s, HEADER *h)
+time_t mutt_parse_date (const char *s, HEADER *h)
{
int count = 0;
char *t;
int zoccident = 0;
const char *ptz;
char tzstr[SHORT_STRING];
+ char scratch[SHORT_STRING];
+ /* Don't modify our argument. Fixed-size buffer is ok here since
+ * the date format imposes a natural limit.
+ */
+
+ strfcpy (scratch, s, sizeof (scratch));
+
/* kill the day of the week, if it exists. */
- if ((t = strchr (s, ',')))
+ if ((t = strchr (scratch, ',')))
t++;
else
- t = s;
+ t = scratch;
SKIPWS (t);
memset (&tm, 0, sizeof (tm));
time_t mutt_local_tz (void);
time_t mutt_mktime (struct tm *, int);
time_t is_from (const char *, char *, size_t);
-time_t mutt_parse_date (char *, HEADER *);
+time_t mutt_parse_date (const char *, HEADER *);
const char *mutt_attach_fmt (
char *dest,