forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of subnet "0.0.0.0/0" in whitelist.
"0.0.0.0/0" is a well-known subnet that contains all possible IPv4 addresses. Envoy whitelist code currently does not handle the "/0" case correctly. The code uses this formula to compute the subnet mask: white_list_entry.ipv4_mask_ = ~((1 << (32 - mask)) - 1); The LHS is an int32_t and the RHS is also computed as a 32-bit value. However, the (<< 32) operation is invalid for a 32-bit value (undefined behavior). The fix makes the RHS first compute as a 64-bits value that later gets truncated to 32-bits on assignment.
- Loading branch information
Enrico Schiattarella
committed
Jan 23, 2017
1 parent
8e746bf
commit 5e2c2b1
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters