[PATCH] Fix segfault upon invalid IP range

Christoph Biedl <[email protected]> Thu, 7 Feb 2013 00:35:17 +0100
Newsgroups gmane.network.poptop
Message-ID <[email protected]>
Description: Fix segfault upon invalid IP range
Author: Sergey Naumov

--- a/pptpd.c
+++ b/pptpd.c
@@ -735,6 +735,16 @@
 				continue;
 			}
 
+			if (upper < lower) {
+			/* if upper < lower segmantation fault in pptpctrl happens
+			 * due to enabling pppLocal parameter without providing its value.
+			 *
+			 * we can safely use ipstr because it is not modified except
+			 * of truncating.
+			 */
+				syslog(LOG_ERR, "MGR: Bad %s IP range: %s", (type == LOCAL)?"local":"remote", ipstr);
+				exit(1);
+			}
 			for (n = lower; n <= upper; n++) {
 				sprintf(tmpstr5, "%s%d%s", ip_pre, n, ip_post);
 				/* Check if the ip address is valid */

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb