From a6cec0388f881c1ff2ded5d8b684be4faf049e5f Mon Sep 17 00:00:00 2001 From: cora32 Date: Sat, 21 Feb 2015 12:51:23 +0300 Subject: [PATCH] JS redirection fix --- finder.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/finder.cpp b/finder.cpp index 8b5a69d..f1a5dd4 100644 --- a/finder.cpp +++ b/finder.cpp @@ -2386,7 +2386,7 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int if(ptr2 != NULL && ptrSemi != NULL) { int sz = ptrSemi - ptr2; - if(sz > 2) + if(sz >= 2) { char *ptrQuote1 = _findFirst(ptr2, "\"'"); if(ptrQuote1 != NULL) @@ -2409,6 +2409,7 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int ZeroMemory(delim, 1); delim[0] = ptrQuote1[0]; delim[1] = '\0'; + char *ptrQuote2 = _findLast(tempBuff + 1, delim); if(ptrQuote2 != NULL) { @@ -2416,13 +2417,17 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int char link[512] = {0}; if(sz < 511) { - if(tempBuff[0] != '/' + if (tempBuff[0] == '.' && tempBuff[1] == '/') + { + strncat(dataBuff, tempBuff + 1, sz - 1); + } + else if(tempBuff[0] != '/' && strstri(tempBuff, "http://") == NULL && strstri(tempBuff, "https://") == NULL ) { strcpy(dataBuff, "/"); - strncat(dataBuff, tempBuff, sz); + strncat(dataBuff, tempBuff + 1, sz - 1); } else strncpy(dataBuff, tempBuff, sz); };