apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject apr_date's functions corrupt the caller's data.
Date Mon, 28 Jan 2002 17:44:32 GMT
apr_date's apr_date_parse_rfc function modifies the date string in the 
caller's namespace and corrupts it. I didn't test all cases but only the 
accepted formats, for the .h docs:

# before : parse_rfc: Sun, 06 Nov 94 08:49 GMT
# after  : parse_rfc: Sun, 06 Nov 94 08:49 00T

# before : parse_rfc: Sun, 6 Nov 94 08:49 GMT
# after  : parse_rfc: Sun, 6 Nov 94 08:49 00T

# before : parse_rfc: Sun, 06 Nov 94 8:49:37 GMT
# after  : parse_rfc: Sun, 06 Nov 9408:49:37 GMT

# before : parse_rfc: Sun, 6 Nov 94 8:49:37 GMT
# after  : parse_rfc: Sun, 6 Nov 9408:49:37 GMT

that happens in all cases similar to this:

         timstr[6] = '0';

This code also could corrupt the data:

         if ((date = strchr(date, ' ')) == NULL)   /* Find space after 
weekday */
             return APR_DATE_BAD;

this one happens in _http version as well.

I've tried walking through the code with gdb, but it looks like code 
gets optimized in a weird way, so I see completely bogus values of date 
while stepping through it.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Mime
View raw message