mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
Use IFNAMESIZE for scope id value
This commit is contained in:
parent
aebf28eba3
commit
b72c862725
@ -204,7 +204,7 @@ pub const Address = extern union {
|
||||
var abbrv = false;
|
||||
|
||||
var scope_id = false;
|
||||
var scope_id_value: [16]u8 = undefined;
|
||||
var scope_id_value: [os.IFNAMESIZE - 1]u8 = undefined;
|
||||
var scope_id_index: usize = 0;
|
||||
|
||||
for (buf) |c, i| {
|
||||
@ -215,6 +215,10 @@ pub const Address = extern union {
|
||||
(c >= 'a' and c <= 'z') or
|
||||
(c == '-') or (c == '.') or (c == '_') or (c == '~'))
|
||||
{
|
||||
if (scope_id_index >= scope_id_value.len) {
|
||||
return error.Overflow;
|
||||
}
|
||||
|
||||
scope_id_value[scope_id_index] = c;
|
||||
scope_id_index += 1;
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user