Author: cgutman
Date: Sun Oct 26 16:44:18 2008
New Revision: 37005
URL:
http://svn.reactos.org/svn/reactos?rev=37005&view=rev
Log:
- Fix a leak
- Fail if the port is out of range
Modified:
branches/aicom-network-fixes/lib/drivers/ip/network/ports.c
branches/aicom-network-fixes/lib/drivers/ip/transport/rawip/rawip.c
Modified: branches/aicom-network-fixes/lib/drivers/ip/network/ports.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers…
==============================================================================
--- branches/aicom-network-fixes/lib/drivers/ip/network/ports.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/lib/drivers/ip/network/ports.c [iso-8859-1] Sun Oct 26
16:44:18 2008
@@ -78,12 +78,11 @@
ULONG AllocatePortFromRange( PPORT_SET PortSet, ULONG Lowest, ULONG Highest ) {
ULONG AllocatedPort;
-
- if (Lowest < PortSet->StartingPort)
- Lowest = PortSet->StartingPort;
-
- if (Highest > PortSet->StartingPort + PortSet->PortsToOversee)
- Highest = PortSet->StartingPort + PortSet->PortsToOversee;
+ if ((Lowest < PortSet->StartingPort) ||
+ (Highest > PortSet->StartingPort + PortSet->PortsToOversee))
+ {
+ return -1;
+ }
Lowest -= PortSet->StartingPort;
Highest -= PortSet->StartingPort;
Modified: branches/aicom-network-fixes/lib/drivers/ip/transport/rawip/rawip.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers…
==============================================================================
--- branches/aicom-network-fixes/lib/drivers/ip/transport/rawip/rawip.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/lib/drivers/ip/transport/rawip/rawip.c [iso-8859-1] Sun
Oct 26 16:44:18 2008
@@ -223,8 +223,10 @@
TI_DbgPrint(MID_TRACE,("About to get route to destination\n"));
- if(!(NCE = RouteGetRouteToDestination( &RemoteAddress )))
+ if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) {
+ FreeNdisPacket(Packet.NdisPacket);
return STATUS_UNSUCCESSFUL;
+ }
TI_DbgPrint(MID_TRACE,("About to send datagram\n"));