Show
Ignore:
Timestamp:
01.10.2010 20:37:20 (9 years ago)
Author:
ak19
Message:

Fix to bug causing depositor to crash library.cgi upon selecting a collection: code was previously looping on parameter names in args to substring them in order to compare them to a prefix. However, it also tried to substring them when the arg parameter name was shorter than the prefix. Fix was necessary in two locations (wizardaction and depositoraction).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/wizardaction.cpp

    r22067 r23012  
    118118       
    119119      int prefix_len = macro_prefix.size(); 
    120        
    121       text_t args_prefix = substr(args_name.begin(),args_name.begin()+prefix_len); 
    122        
    123       if (args_prefix == macro_prefix) { 
    124     saved_args[args_name] = args[args_name]; 
    125       }  
     120      int args_name_len = args_name.size(); 
     121 
     122      if(args_name_len >= prefix_len) { // Only now can we substring args_name by prefix_len 
     123          text_t args_prefix; 
     124          if(args_name_len > prefix_len) { // substring 
     125            args_prefix = substr(args_name.begin(),args_name.begin()+prefix_len); 
     126          } else { 
     127            args_prefix = args_name; 
     128          } 
     129       
     130          if (args_prefix == macro_prefix) { 
     131            saved_args[args_name] = args[args_name]; 
     132          }  
     133      } 
    126134      ++args_here; 
    127135    }