Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix a memory double-free'd problem. In function <tt>cgi_set_cookie</tt> the <tt>zDate</tt> was allocated via usage of <tt>cgi_rfc822_datestamp</tt>. But as it was appended to the blob <tt>extraHeader</tt> via the format specifier <tt>%z</tt> the memory was free'd by <tt>blob_appendf</tt>. As <tt>cgi_rfc822_datestamp</tt> might return both a dynamic allocated empty string as well as a dynamic allocated string containing the time stamp, <tt>blob_appendf</tt> should not try to free the <tt>zDate</tt>. So now the format specifier is changed to <tt>%s</tt> to let us decide, if we want to free the memory or not. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
aeeba751c4d8b704d3fe774eb4074e9b |
| User & Date: | cle 2008-09-11 17:12:11.000 |
Context
|
2008-09-18
| ||
| 11:21 | added comments about necessary link flags for Solaris 10 + OpenSolaris ... (check-in: 7dddab2fbe user: stephan tags: trunk) | |
|
2008-09-11
| ||
| 17:12 | Fix a memory double-free'd problem. In function <tt>cgi_set_cookie</tt> the <tt>zDate</tt> was allocated via usage of <tt>cgi_rfc822_datestamp</tt>. But as it was appended to the blob <tt>extraHeader</tt> via the format specifier <tt>%z</tt> the memory was free'd by <tt>blob_appendf</tt>. As <tt>cgi_rfc822_datestamp</tt> might return both a dynamic allocated empty string as well as a dynamic allocated string containing the time stamp, <tt>blob_appendf</tt> should not try to free the <tt>zDate</tt>. So now the format specifier is changed to <tt>%s</tt> to let us decide, if we want to free the memory or not. ... (check-in: aeeba751c4 user: cle tags: trunk) | |
|
2008-09-07
| ||
| 08:32 | Remove small glitch that prevent fossil to be built with BSD make. ... (check-in: f3fb059eb6 user: cle tags: trunk) | |
Changes
Changes to src/cgi.c.
| ︙ | ︙ | |||
200 201 202 203 204 205 206 |
int lifetime /* Expiration of the cookie in seconds from now */
){
if( zPath==0 ) zPath = g.zTop;
if( lifetime>0 ){
lifetime += (int)time(0);
char * zDate = cgi_rfc822_datestamp(lifetime);
blob_appendf(&extraHeader,
| | | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
int lifetime /* Expiration of the cookie in seconds from now */
){
if( zPath==0 ) zPath = g.zTop;
if( lifetime>0 ){
lifetime += (int)time(0);
char * zDate = cgi_rfc822_datestamp(lifetime);
blob_appendf(&extraHeader,
"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,
"Set-Cookie: %s=%t; Path=%s; Version=1\r\n",
zName, zValue, zPath);
}
|
| ︙ | ︙ |