--- parser3/src/targets/isapi/parser3isapi.C 2020/12/15 17:10:38 1.124 +++ parser3/src/targets/isapi/parser3isapi.C 2024/11/04 03:53:25 1.129 @@ -1,11 +1,11 @@ /** @file Parser: IIS extension. - Copyright (c) 2000-2020 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2000-2024 Art. Lebedev Studio (http://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ -volatile const char * IDENT_PARSER3ISAPI_C="$Id: parser3isapi.C,v 1.124 2020/12/15 17:10:38 moko Exp $"; +volatile const char * IDENT_PARSER3ISAPI_C="$Id: parser3isapi.C,v 1.129 2024/11/04 03:53:25 moko Exp $"; #ifndef _MSC_VER # error compile ISAPI module with MSVC [no urge for now to make it autoconf-ed (PAF)] @@ -272,8 +272,7 @@ static void parser_done() { /// ISAPI // BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) { pVer->dwExtensionVersion = HSE_VERSION; - strncpy(pVer->lpszExtensionDesc, "Parser " PARSER_VERSION, HSE_MAX_EXT_DLL_NAME_LEN-1); - pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1]=0; + pa_strncpy(pVer->lpszExtensionDesc, "Parser " PARSER_VERSION, HSE_MAX_EXT_DLL_NAME_LEN); return parser_init(); } // dwFlags & HSE_TERM_MUST_UNLOAD means we can't return false @@ -299,7 +298,7 @@ BOOL WINAPI TerminateExtension( */ void real_parser_handler(SAPI_Info& SAPI_info, bool header_only) { // collect garbage from prev request - PA_GC_GCOLLECT; + pa_gc_collect(); SAPI_info.header=new String; LPEXTENSION_CONTROL_BLOCK lpECB=SAPI_info.lpECB; @@ -307,8 +306,7 @@ void real_parser_handler(SAPI_Info& SAPI // Request info Request_info request_info; memset(&request_info, 0, sizeof(request_info)); - size_t path_translated_buf_size=strlen(lpECB->lpszPathTranslated)+1; - char *filespec_to_process=pa_strdup(lpECB->lpszPathTranslated, path_translated_buf_size); + char *filespec_to_process=pa_strdup(lpECB->lpszPathTranslated); #ifdef WIN32 back_slashes_to_slashes(filespec_to_process); #endif @@ -316,8 +314,8 @@ void real_parser_handler(SAPI_Info& SAPI if(const char* path_info=SAPI::Env::get(SAPI_info, "PATH_INFO")) { // IIS size_t len=strlen(filespec_to_process)-strlen(path_info); - char *buf=new(PointerFreeGC) char[len+1]; - strncpy(buf, filespec_to_process, len); buf[len]=0; + char *buf=new(PointerFreeGC) char[len]; + pa_strncpy(buf, filespec_to_process, len); request_info.document_root=buf; } else throw Exception(PARSER_RUNTIME, 0, "ISAPI: no PATH_INFO defined (in reinventing DOCUMENT_ROOT)"); @@ -336,7 +334,7 @@ void real_parser_handler(SAPI_Info& SAPI // beside by binary static char beside_binary_path[MAX_STRING]; - strncpy(beside_binary_path, argv0, MAX_STRING-1); beside_binary_path[MAX_STRING-1]=0; // filespec of my binary + pa_strncpy(beside_binary_path, argv0, MAX_STRING); // filespec of my binary if(!(rsplit(beside_binary_path, '/') || rsplit(beside_binary_path, '\\'))) { // strip filename // no path, just filename beside_binary_path[0]='.'; beside_binary_path[1]=0;