Skip to content

Commit

Permalink
Fix double-close of registry key. Fixes #1163
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Mar 29, 2018
1 parent 68ae96b commit 6d3eb4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* Fix a double-close of a Registry key which could cause a crash in Packet.dll
when debugging. Fixes [#1163](http://issues.nmap.org/1163).

## Npcap 0.99-r2 [2018-03-13]

* Fix installer to work on 32-bit Windows.
Expand Down
7 changes: 0 additions & 7 deletions packetWin7/Dll/AdInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ static BOOLEAN PacketGetAddressesFromRegistry(LPCSTR AdapterNameA, PNPF_IF_ADDRE
status = RegQueryValueEx(TcpIpKey,TEXT("DhcpIPAddress"),NULL,&RegType,(LPBYTE)String,&BufLen);
if (status != ERROR_SUCCESS) {
RegCloseKey(TcpIpKey);
RegCloseKey(UnderTcpKey);
goto fail;
}

Expand Down Expand Up @@ -425,7 +424,6 @@ static BOOLEAN PacketGetAddressesFromRegistry(LPCSTR AdapterNameA, PNPF_IF_ADDRE
status = RegQueryValueEx(TcpIpKey,TEXT("DhcpSubnetMask"),NULL,&RegType,(LPBYTE)String,&BufLen);
if (status != ERROR_SUCCESS) {
RegCloseKey(TcpIpKey);
RegCloseKey(UnderTcpKey);
goto fail;
}

Expand Down Expand Up @@ -463,7 +461,6 @@ static BOOLEAN PacketGetAddressesFromRegistry(LPCSTR AdapterNameA, PNPF_IF_ADDRE
// The number of masks MUST be equal to the number of adresses
if(nmasks != naddrs){
RegCloseKey(TcpIpKey);
RegCloseKey(UnderTcpKey);
goto fail;
}

Expand All @@ -476,7 +473,6 @@ static BOOLEAN PacketGetAddressesFromRegistry(LPCSTR AdapterNameA, PNPF_IF_ADDRE
status = RegQueryValueEx(TcpIpKey,TEXT("IPAddress"),NULL,&RegType,(LPBYTE)String,&BufLen);
if (status != ERROR_SUCCESS) {
RegCloseKey(TcpIpKey);
RegCloseKey(UnderTcpKey);
goto fail;
}

Expand Down Expand Up @@ -535,7 +531,6 @@ static BOOLEAN PacketGetAddressesFromRegistry(LPCSTR AdapterNameA, PNPF_IF_ADDRE
status = RegQueryValueEx(TcpIpKey,TEXT("SubnetMask"),NULL,&RegType,(LPBYTE)String,&BufLen);
if (status != ERROR_SUCCESS) {
RegCloseKey(TcpIpKey);
RegCloseKey(UnderTcpKey);
goto fail;
}

Expand Down Expand Up @@ -574,14 +569,12 @@ static BOOLEAN PacketGetAddressesFromRegistry(LPCSTR AdapterNameA, PNPF_IF_ADDRE
// The number of masks MUST be equal to the number of adresses
if(nmasks != naddrs){
RegCloseKey(TcpIpKey);
RegCloseKey(UnderTcpKey);
goto fail;
}

}

RegCloseKey(TcpIpKey);
RegCloseKey(UnderTcpKey);

if (status != ERROR_SUCCESS) {
goto fail;
Expand Down

0 comments on commit 6d3eb4d

Please sign in to comment.