Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/plugin/PluginClientBase.cpp

Issue 10955040: Fix domain whitelisting and remove unused code (Closed)
Left Patch Set: Created June 25, 2013, 9:42 a.m.
Right Patch Set: Addressed all issues Created June 25, 2013, 2:19 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 // Internet / FTP 3 // Internet / FTP
4 #include <wininet.h> 4 #include <wininet.h>
5 5
6 // IP adapter 6 // IP adapter
7 #include <iphlpapi.h> 7 #include <iphlpapi.h>
8 8
9 #include "PluginSettings.h" 9 #include "PluginSettings.h"
10 #include "PluginSystem.h" 10 #include "PluginSystem.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 43
44 bool CPluginClientBase::IsValidDomain(const CString& domain) 44 bool CPluginClientBase::IsValidDomain(const CString& domain)
45 { 45 {
46 return domain != ABPDOMAIN && 46 return domain != ABPDOMAIN &&
47 domain != USERS_HOST && 47 domain != USERS_HOST &&
48 domain != L"about:blank" && 48 domain != L"about:blank" &&
49 domain != L"about:tabs" && 49 domain != L"about:tabs" &&
50 domain.Find(L"javascript:") != 0 && 50 domain.Find(L"javascript:") != 0 &&
51 !domain.IsEmpty(); 51 !domain.IsEmpty();
52 }
53
54
55 CString CPluginClientBase::ExtractDomain(const CString& url)
56 {
57 int pos = 0;
58 CString http = url.Find('/',pos) >= 0 ? url.Tokenize(L"/", pos) : L"";
59 CString domain = url.Tokenize(L"/", pos);
60
61 domain.MakeLower();
62
63 return domain;
64 } 52 }
65 53
66 54
67 CString& CPluginClientBase::UnescapeUrl(CString& url) 55 CString& CPluginClientBase::UnescapeUrl(CString& url)
68 { 56 {
69 CString unescapedUrl; 57 CString unescapedUrl;
70 DWORD cb = 2048; 58 DWORD cb = 2048;
71 59
72 if (SUCCEEDED(::UrlUnescape(url.GetBuffer(), unescapedUrl.GetBufferSetLength(c b), &cb, 0))) 60 if (SUCCEEDED(::UrlUnescape(url.GetBuffer(), unescapedUrl.GetBufferSetLength(c b), &cb, 0)))
73 { 61 {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 136
149 hasError = true; 137 hasError = true;
150 138
151 s_pluginErrors.erase(it); 139 s_pluginErrors.erase(it);
152 } 140 }
153 } 141 }
154 s_criticalSectionLocal.Unlock(); 142 s_criticalSectionLocal.Unlock();
155 143
156 return hasError; 144 return hasError;
157 } 145 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld