--- parser3/src/main/pa_exec.C 2003/03/26 18:52:50 1.48.2.18.2.11 +++ parser3/src/main/pa_exec.C 2003/04/07 15:32:57 1.48.2.18.2.14 @@ -7,7 +7,7 @@ @todo setrlimit */ -static const char* IDENT_EXEC_C="$Date: 2003/03/26 18:52:50 $"; +static const char* IDENT_EXEC_C="$Date: 2003/04/07 15:32:57 $"; #include "pa_config_includes.h" @@ -115,9 +115,10 @@ static void read_pipe(String& result, HA while(true) { char *buf=new(PointerFreeGC) char[MAX_STRING]; unsigned long size; - if(!ReadFile(hOutRead, buf, MAX_STRING, &size, NULL) || !size) + if(!ReadFile(hOutRead, buf, MAX_STRING-1, &size, NULL) || !size) break; - result.append(buf, size, lang); + buf[size]=0; + result.append_help_length(buf, size, lang); } } @@ -279,10 +280,11 @@ static int get_exit_status(int pid) { static void read_pipe(String& result, int file, String::Language lang){ while(true) { char *buf=new(PointerFreeGC) char[MAX_STRING]; - ssize_t size=read(file, buf, MAX_STRING); - if(size<=0) + ssize_t length=read(file, buf, MAX_STRING-1); + if(length<=0) break; - result.append(buf, size, lang); + buf[length]=0; + result.append_help_length(buf, length, lang); } } @@ -303,7 +305,7 @@ static void append_env_pair(HashStringSt Append_env_pair_info *info) { #ifdef WIN32 info->string << key << "=" << value; - info->string.append("", 1, String::L_AS_IS); // zero byte + info->string.append_help_length("", 1, String::L_AS_IS); // zero byte #else StringBody body; body << key << "=" << value; @@ -392,12 +394,7 @@ from http://www.apache.org/websrc/cvsweb "stat failed: %s (%d), actual filename '%s'", strerror(errno), errno, file_spec_cstr); - if(finfo.st_uid/*foreign?*/!=geteuid() - && finfo.st_gid/*foreign?*/!=getegid()) - throw Exception("parser.runtime", - &file_spec, - "parser is in safe mode: executing files of foreign group and user disabled [recompile parser with --disable-safe-mode configure option], actual filename '%s'", - file_spec_cstr); + check_safe_mode(finfo, file_spec, file_spec_cstr); } #endif