Differences From:
File src/cgi.c part of check-in [070e63db33] - Merge old tagview branch into this branch by eric on 2008-08-17 20:53:20. Also file src/cgi.c part of check-in [8745d0d579] - Merge tagview branch into mainline by eric on 2008-09-06 13:29:29. [view]
To:
File src/cgi.c part of check-in [aeeba751c4] - Fix a memory double-free'd problem.In function cgi_set_cookie the zDate was allocated via usage of cgi_rfc822_datestamp. But as it was appended to the blob extraHeader via the format specifier %z the memory was free'd by blob_appendf. As cgi_rfc822_datestamp might return both a dynamic allocated empty string as well as a dynamic allocated string containing the time stamp, blob_appendf should not try to free the zDate. So now the format specifier is changed to %s to let us decide, if we want to free the memory or not.
by cle on 2008-09-11 17:12:11. [view]
@@ -203,9 +203,9 @@ if( lifetime>0 ){ lifetime += (int)time(0); char * zDate = cgi_rfc822_datestamp(lifetime); blob_appendf(&extraHeader, - "Set-Cookie: %s=%t; Path=%s; expires=%z; Version=1\r\n", + "Set-Cookie: %s=%t; Path=%s; expires=%s; Version=1\r\n", zName, zValue, zPath, zDate); if( zDate[0] ) free( zDate ); }else{ blob_appendf(&extraHeader,