Changeset 18824

Show
Ignore:
Timestamp:
27.03.2009 17:08:43 (10 years ago)
Author:
mdewsnip
Message:

Fixed get_cookie() so that it checks that cookiestring isn't empty before trying to fiddle with it, to prevent crashes on Windows.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/runtime-src/src/recpt/receptionist.cpp

    r18818 r18824  
    674674 
    675675  text_t cookiestring = gsdl_getenv ("HTTP_COOKIE", fcgienv); 
    676  
    677   text_t::const_iterator end = cookiestring.end();   
    678   text_t::const_iterator here = findchar ((text_t::const_iterator)cookiestring.begin(), end, 'G'); 
    679  
    680   while (here+9 < end) {  
     676  if (!cookiestring.empty()) 
     677  { 
     678    text_t::const_iterator end = cookiestring.end();   
     679    text_t::const_iterator here = findchar ((text_t::const_iterator)cookiestring.begin(), end, 'G'); 
     680 
     681    while (here+9 < end) {  
    681682     
    682     if (substr(here, here+8) == "GSDL_UID") { 
    683       cookie = substr (here+9, findchar (here+9, end, ';'));  
    684       return true; 
    685     } 
    686     ++here; 
    687     here = findchar (here, end, 'G'); 
     683      if (substr(here, here+8) == "GSDL_UID") { 
     684    cookie = substr (here+9, findchar (here+9, end, ';'));  
     685    return true; 
     686      } 
     687      ++here; 
     688      here = findchar (here, end, 'G'); 
     689    } 
    688690  } 
    689691