Skip to content

NetworkPkg/Ip4Dxe: Reject IPv4 addresses ending with dot#12404

Open
AbuthahirM11 wants to merge 1 commit intotianocore:masterfrom
AbuthahirM11:abu/ipv4-validation-fix
Open

NetworkPkg/Ip4Dxe: Reject IPv4 addresses ending with dot#12404
AbuthahirM11 wants to merge 1 commit intotianocore:masterfrom
AbuthahirM11:abu/ipv4-validation-fix

Conversation

@AbuthahirM11
Copy link
Copy Markdown

@AbuthahirM11 AbuthahirM11 commented Apr 7, 2026

This PR fixes a validation issue where the IPv4 Network Configuration
UI accepts invalid IPv4 addresses ending with a dot.

The fix adds proper validation to reject addresses like:

  • 192.168.1.10.
  • 255.255.255.0.
  • 1.1.1.1.

After this fix, such malformed addresses are properly rejected with
an "Invalid" popup.

Cc: Saloni Kasbekar saloni.kasbekar@intel.com
Cc: Zachary Clark-williams zachary.clark-williams@intel.com
Cc: Michael D Kinney michael.d.kinney@intel.com

Signed-off-by: Abuthahir M abuthahirm@ami.com

Issue: UI accepts invalid IPv4 addresses ending with a dot in the
IPv4 Network Configuration page. Examples:
- Local IP Address: 192.168.1.10.
- Subnet Mask: 255.255.255.0.
- Gateway: 2.2.2.2.
- DNS Servers: 1.1.1.1.

Root Cause:
The function Ip4Config2StrToIp converts user-entered IPv4 strings
into numbers. When an address ending with a dot like '1.1.1.1.' is
entered, the code skips over the 4th dot, reaches the string's null
terminator, and incorrectly treats it as valid. A proper IPv4
address must have exactly 3 dots, but the code never enforced this.

Fix:
Before skipping a dot, add a check: if already processed 3 dots,
return EFI_INVALID_PARAMETER. This prevents accepting malformed
inputs like '1.1.1.1.' or '1.1.1..1'.

Signed-off-by: Abuthahir M <abuthahirm@ami.com>
@AbuthahirM11
Copy link
Copy Markdown
Author

@leiflindholm @ajfish @ardbiesheuvel @makubacki @mdkinney @Zclarkwilliams — Could you please take a look and approve this PR when you get a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants