Skip to content

Commit

Permalink
fix: Check for invalid group hexes
Browse files Browse the repository at this point in the history
  • Loading branch information
mochalins authored and ikskuh committed Jun 15, 2024
1 parent fe1a17c commit 117d0d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion network.zig
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ pub const Address = union(AddressFamily) {
cg_index += 1;
groups[cg_index].ptr = string[i + 1 ..].ptr;
},
'a'...'z', 'A'...'Z', '0'...'9' => {
'a'...'f', 'A'...'F', '0'...'9' => {
groups[cg_index].len += 1;
},
else => {
Expand Down Expand Up @@ -285,6 +285,10 @@ pub const Address = union(AddressFamily) {

// Group index, accounting for abbreviations.
for (groups, 0..) |group, i| {
if (group.len > 4) {
return error.InvalidFormat;
}

// Second byte in group to be parsed.
var b2 = group;

Expand Down

0 comments on commit 117d0d5

Please sign in to comment.