File filezilla-int_overflow.patch of Package filezilla

--- src/engine/transfersocket.cpp
+++ src/engine/transfersocket.cpp
@@ -523,7 +523,7 @@
 	if (start < low || start > high)
 	{
 		srand( (unsigned)time( NULL ) );
-		start = rand() * (high - low) / (RAND_MAX + 1) + low;
+		start = rand() * (high - low) / (RAND_MAX < INT_MAX ? RAND_MAX + 1 : RAND_MAX) + low;
 	}
 
 	for (int i = start; i <= high; i++)
--- src/interface/netconfwizard.cpp
+++ src/interface/netconfwizard.cpp
@@ -864,7 +864,7 @@
 		XRCCTRL(*this, "ID_ACTIVE_PORTMIN", wxTextCtrl)->GetValue().ToLong(&low);
 		XRCCTRL(*this, "ID_ACTIVE_PORTMAX", wxTextCtrl)->GetValue().ToLong(&high);
 		
-		int mid = (rand() * (high - low)) / (RAND_MAX + 1) + low;
+		int mid = (rand() * (high - low)) / (RAND_MAX < INT_MAX ? RAND_MAX + 1 : RAND_MAX) + low;
 		for (int port = mid; port <= high; port++)
 			if (CreateListenSocket(port))
 				return port;
openSUSE Build Service is sponsored by