Explorar o código

bug fix: multiply allocation count by sizeof route_entry

Eugene Yakubovich %!s(int64=10) %!d(string=hai) anos
pai
achega
c7734b0394
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      udp/proxy.c

+ 1 - 1
udp/proxy.c

@@ -157,7 +157,7 @@ static int set_route(struct ip_net dst, struct sockaddr_in *next_hop) {
 
 	if( routes_alloc == routes_cnt ) {
 		int new_alloc = (routes_alloc ? 2*routes_alloc : 8);
-		struct route_entry *new_routes = (struct route_entry *) realloc(routes, new_alloc);
+		struct route_entry *new_routes = (struct route_entry *) realloc(routes, new_alloc*sizeof(struct route_entry));
 		if( !new_routes )
 			return ENOMEM;