瀏覽代碼

[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 年之前
父節點
當前提交
57bab4e1d3
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      src/net/tcpip.c

+ 1
- 1
src/net/tcpip.c 查看文件

@@ -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…
取消
儲存