From: haroon Date: Wed, 18 Jul 2001 15:02:52 +0000 (+0000) Subject: improved nuking of window.open X-Git-Tag: v_2_9_9~234 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=ce9c9172cecc1748e2fd208961332c37e2462b50 improved nuking of window.open --- diff --git a/killpopup.c b/killpopup.c index 95dfabb6..6187b7e0 100644 --- a/killpopup.c +++ b/killpopup.c @@ -90,7 +90,6 @@ const char killpopup_h_rcs[] = KILLPOPUP_H_VERSION; * Description : Filter the block of data that's been read from the server. * Caller is responsible for checking permissons list * to determine if this function should be called. - * FIXME: Should use the replacements proposed by Guy * * Parameters : * 1 : buff = Buffer to scan and modify. Null terminated. @@ -104,7 +103,6 @@ void filter_popups(char *buff, int size) char *popup = NULL; char *close = NULL; char *p = NULL; - char *q = NULL; /* by BREITENB NEW! */ while ((popup = strstr( buff, "window.open(" )) != NULL) { @@ -117,7 +115,9 @@ void filter_popups(char *buff, int size) #ifdef POPUP_VERBOSE fprintf(logfp, "Found end of window open" ); #endif - for ( p = popup; p != (close+1); p++ ) + p = popup; + *p++ = '1'; + for ( ; p != (close+1); p++ ) { *p = ' '; } @@ -130,23 +130,20 @@ void filter_popups(char *buff, int size) #ifdef POPUP_VERBOSE fprintf(logfp, "Couldn't find end, turned into comment. Read boundary?\n" ); #endif + *popup++ = '1'; + *popup++ = ';'; + *popup++ = '/'; *popup = '/'; - popup++; - *popup = '/'; - } - - - q=popup; /* by BREITENB NEW! */ - while (q>=buff) - { - if (*q==' ' || *q=='\t') - q--; - else break; - } - if (q>=buff) - { - if (*q=='=') *++q='1'; - /* result of popup is assigned to a variable! ensure success. hehehe. */ + /* + * result of popup is assigned to variable and the rest commented out + * window.open(blah + * will be translated to + * 1;//ow.open(blah + * and + * myWindow = window.open(blah + * will be translated to + * myWindow = 1;//ow.open(blah + */ } }