From:             navara at emclient dot com
Operating system: Windows
PHP version:      5.2.6
PHP Bug Type:     Reproducible crash
Bug description:  ISAPI doesn't property clear auth_digest in header

Description:
------------
The crash happens when client sends HTTP_AUTHORIZATION header starting
with "Digest " once and then makes another request with no authorization
request specified. Underlying reason is that SG(request_info).auth_digest
is set on the first request and later freed when the request is finished,
but SG(request_info).auth_digest is never cleared. Thus on next request
SG(request_info).auth_digest still contains the old pointer and once the
request shutdown is performed the already freed pointer is accessed.

Patch below fixes it, though using sapi_initialize_empty_request on
appropriate place might be a better fix.

--- sapi\isapi\php5isapi.c
+++ sapi\isapi\php5isapi.c
@@ -711,6 +711,7 @@
                case SF_NOTIFY_PREPROC_HEADERS:
                        SG(request_info).auth_user = NULL;
                        SG(request_info).auth_password = NULL;
+                       SG(request_info).auth_digest = NULL;
                        break;
                case SF_NOTIFY_AUTHENTICATION: {
                                char *auth_user = ((HTTP_FILTER_AUTHENT *) 
pvNotification)->pszUser;
@@ -745,7 +746,7 @@
        SG(request_info).content_length = lpECB->cbTotalBytes;
        SG(sapi_headers).http_response_code = 200;  /* I think dwHttpStatusCode
is invalid at this stage -RL */
        if (!bFilterLoaded) { /* we don't have valid ISAPI Filter information
*/
-               SG(request_info).auth_user = SG(request_info).auth_password = 
NULL;
+               SG(request_info).auth_user = SG(request_info).auth_password =
SG(request_info).auth_digest = NULL;
        }
 
 #ifdef WITH_ZEUS



-- 
Edit bug report at http://bugs.php.net/?id=45568&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45568&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45568&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45568&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45568&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45568&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45568&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45568&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45568&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45568&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45568&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45568&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45568&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45568&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45568&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45568&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45568&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45568&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45568&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45568&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45568&r=mysqlcfg

Reply via email to