Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: AutoWebProxyScriptEngine.InitializeRegistryGlobalProxy #10030

Closed
KevinKeyser opened this issue Aug 10, 2018 · 2 comments · Fixed by #12595

Comments

@KevinKeyser
Copy link

@KevinKeyser KevinKeyser commented Aug 10, 2018

InitializeRegistryGlobalProxy should not error out if ProxyEnable is true and ProxyServer is null. All other applications and services work when my registry has proxyenabled with no proxyserver key. The only test I tried is when using System.Net.WebRequest.Create() and InitializeRegistryGlobalProxy throws a null object exception which I believe is on this line of code:

if (strProxyServer.Contains ("=")) {
.

This should get a null check or default value of an empty string e.g. :
1.) set strProxyServer default value to String.Empty or equivalent.
string strProxyServer = (string)Microsoft.Win32.Registry.GetValue ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", String.Empty);
2.) null check for strProxyServer could be on the line 127 before checking strProxyServer.Contains("=").

@witcher112

This comment has been minimized.

Copy link
Contributor

@witcher112 witcher112 commented Jan 24, 2019

I can confirm that this issue is real. We are using Unity as a base for our application and one of our users had "ProxyEnable" set to true in his registry, but "ProxyServer" entry was missing. That lead to crash while using HttpWebRequest. I'm attaching a stack trace:

  at System.Net.AutoWebProxyScriptEngine.InitializeRegistryGlobalProxy () [0x0005b] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.AutoWebProxyScriptEngine.GetWebProxyData () [0x00007] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.WebProxy.UnsafeUpdateFromRegistry () [0x0001a] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.WebProxy..ctor (System.Boolean enableAutoproxy) [0x0000d] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.WebProxy.CreateDefaultProxy () [0x00012] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.Configuration.DefaultProxySectionInternal.GetSystemWebProxy () [0x00000] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.Configuration.DefaultProxySectionInternal.GetDefaultProxy_UsingOldMonoCode () [0x00036] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.Configuration.DefaultProxySectionInternal.GetSection () [0x00015] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.WebRequest.get_InternalDefaultWebProxy () [0x00022] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.HttpWebRequest..ctor (System.Uri uri) [0x0008d] in <3845a180c26b4889bc2d47593a665814>:0 
  at (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest..ctor(System.Uri)
  at System.Net.HttpRequestCreator.Create (System.Uri uri) [0x00000] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) [0x00091] in <3845a180c26b4889bc2d47593a665814>:0 
  at System.Net.WebRequest.Create (System.Uri requestUri) [0x00014] in <3845a180c26b4889bc2d47593a665814>:0 
  at PatchKit.Network.DefaultHttpClient.Request (PatchKit.Network.BaseHttpRequest request, System.Action`1[T] tweakMethodSpecific) [0x0004d] in <76072dbeb0ed464c99ae3b2b05a36cb7>:0 
  at PatchKit.Network.DefaultHttpClient.Get (PatchKit.Network.HttpGetRequest getRequest) [0x00014] in <76072dbeb0ed464c99ae3b2b05a36cb7>:0 
  at PatchKit.Unity.Patcher.AppData.Remote.Downloaders.BaseHttpDownloader.Download (PatchKit.Unity.Patcher.Cancellation.CancellationToken cancellationToken) [0x00117] in <429f6f228c784881aeed5c87f323036e>:0 ```
@witcher112

This comment has been minimized.

Copy link
Contributor

@witcher112 witcher112 commented Jan 24, 2019

Pull request has been sent - I've chosen to go with second option:

2.) null check for strProxyServer could be on the line 127 before checking strProxyServer.Contains("=").

akoeplinger added a commit that referenced this issue Jan 25, 2019
This fixes NullReferenceException that was thrown if:
-
 HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyEnable was set to true (1)
-
 HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyServer was set to null

Fixes #10030
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Apr 24, 2019
Bumps to mono/api-snapshot@ae01378
Bumps to mono/reference-assemblies@e5173a5
Bumps to mono/bockbuild@d30329d
Bumps to mono/boringssl@3d87996
Bumps to mono/corefx@72f7d76
Bumps to mono/corert@1b7d4a1
Bumps to mono/helix-binaries@7e893ea
Bumps to mono/illinker-test-assets@f21ff68
Bumps to mono/linker@13d864e
Bumps to mono/llvm@1aaaaa5 [mono]
Bumps to mono/llvm@2c2cffe [xamarin-android]
Bumps to mono/NUnitLite@0029561
Bumps to mono/roslyn-binaries@0bbc9b4
Bumps to mono/xunit-binaries@8f6e62e

	$ git diff --shortstat 886c4901..e66c7667      # mono
        3597 files changed, 350850 insertions(+), 91128 deletions(-)
	$ git diff --shortstat 349752c464c5fc93b32e7d45825f2890c85c8b7d..2c2cffedf01e0fe266b9aaad2c2563e05b750ff4
	 240 files changed, 18562 insertions(+), 6581 deletions(-)

Context: dotnet/coreclr#22046

Fixes: CVE 2018-8292 on macOS
Fixes: http://work.devdiv.io/737323
Fixes: dotnet/corefx#33965
Fixes: dotnet/standard#642
Fixes: mono/mono#6997
Fixes: mono/mono#7326
Fixes: mono/mono#7517
Fixes: mono/mono#7750
Fixes: mono/mono#7859
Fixes: mono/mono#8360
Fixes: mono/mono#8460
Fixes: mono/mono#8766
Fixes: mono/mono#8922
Fixes: mono/mono#9418
Fixes: mono/mono#9507
Fixes: mono/mono#9951
Fixes: mono/mono#10024
Fixes: mono/mono#10030
Fixes: mono/mono#10038
Fixes: mono/mono#10448
Fixes: mono/mono#10735
Fixes: mono/mono#10735
Fixes: mono/mono#10737
Fixes: mono/mono#10743
Fixes: mono/mono#10834
Fixes: mono/mono#10837
Fixes: mono/mono#10838
Fixes: mono/mono#10863
Fixes: mono/mono#10945
Fixes: mono/mono#11020
Fixes: mono/mono#11021
Fixes: mono/mono#11021
Fixes: mono/mono#11049
Fixes: mono/mono#11091
Fixes: mono/mono#11095
Fixes: mono/mono#11123
Fixes: mono/mono#11138
Fixes: mono/mono#11146
Fixes: mono/mono#11202
Fixes: mono/mono#11214
Fixes: mono/mono#11317
Fixes: mono/mono#11326
Fixes: mono/mono#11378
Fixes: mono/mono#11385
Fixes: mono/mono#11478
Fixes: mono/mono#11479
Fixes: mono/mono#11488
Fixes: mono/mono#11489
Fixes: mono/mono#11527
Fixes: mono/mono#11529
Fixes: mono/mono#11596
Fixes: mono/mono#11603
Fixes: mono/mono#11613
Fixes: mono/mono#11623
Fixes: mono/mono#11663
Fixes: mono/mono#11681
Fixes: mono/mono#11684
Fixes: mono/mono#11693
Fixes: mono/mono#11697
Fixes: mono/mono#11779
Fixes: mono/mono#11809
Fixes: mono/mono#11858
Fixes: mono/mono#11895
Fixes: mono/mono#11898
Fixes: mono/mono#11898
Fixes: mono/mono#11965
Fixes: mono/mono#12182
Fixes: mono/mono#12193
Fixes: mono/mono#12218
Fixes: mono/mono#12235
Fixes: mono/mono#12263
Fixes: mono/mono#12307
Fixes: mono/mono#12331
Fixes: mono/mono#12362
Fixes: mono/mono#12374
Fixes: mono/mono#12402
Fixes: mono/mono#12421
Fixes: mono/mono#12461
Fixes: mono/mono#12479
Fixes: mono/mono#12479
Fixes: mono/mono#12552
Fixes: mono/mono#12603
Fixes: mono/mono#12747
Fixes: mono/mono#12831
Fixes: mono/mono#12843
Fixes: mono/mono#12881
Fixes: mono/mono#13030
Fixes: mono/mono#13284
Fixes: mono/mono#13297
Fixes: mono/mono#13455
Fixes: mono/mono#13460
Fixes: mono/mono#13478
Fixes: mono/mono#13479
Fixes: mono/mono#13522
Fixes: mono/mono#13607
Fixes: mono/mono#13610
Fixes: mono/mono#13610
Fixes: mono/mono#13639
Fixes: mono/mono#13672
Fixes: mono/mono#13834
Fixes: mono/mono#13878
Fixes: mono/mono#6352
Fixes: mono/monodevelop#6898
Fixes: xamarin/maccore#1069
Fixes: xamarin/maccore#1407
Fixes: xamarin/maccore#604
Fixes: xamarin/xamarin-macios#4984
Fixes: xamarin/xamarin-macios#5289
Fixes: xamarin/xamarin-macios#5363
Fixes: xamarin/xamarin-macios#5381
Fixes: https://issuetracker.unity3d.com/issues/editor-crashes-with-g-logv-when-entering-play-mode-with-active-flowcanvas-script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.