Browse Source

[tcpip] Fix dubious calculation of min_port

Detected using sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
57bab4e1d3
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      src/net/tcpip.c

+ 1
- 1
src/net/tcpip.c View File

@@ -235,7 +235,7 @@ int tcpip_bind ( struct sockaddr_tcpip *st_local,
235 235
 	/* Otherwise, find an available port in the range [1,1023] or
236 236
 	 * [1025,65535] as appropriate.
237 237
 	 */
238
-	min_port = ( ( ( ! flags ) & TCPIP_BIND_PRIVILEGED ) + 1 );
238
+	min_port = ( ( ( ~flags ) & TCPIP_BIND_PRIVILEGED ) + 1 );
239 239
 	max_port = ( ( flags & TCPIP_BIND_PRIVILEGED ) - 1 );
240 240
 	offset = random();
241 241
 	for ( i = 0 ; i <= max_port ; i++ ) {

Loading…
Cancel
Save