authorgravatar for git@l4.pmLuna <git@l4.pm> 2020-04-02 18:13:10-03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-06-02 14:56:06-04:00
logb72c862725f6005250cb906e96d41bd1b80fd7ca
treefbb9394570d900c4335ea1276c8c3a274f647f28
parentaebf28eba313f6472395bd3fbba3f79dba5326bd

Use IFNAMESIZE for scope id value


1 files changed, 5 insertions(+), 1 deletions(-)

lib/std/net.zig+5-1
......@@ -204,7 +204,7 @@ pub const Address = extern union {
204204 var abbrv = false;
205205
206206 var scope_id = false;
207 var scope_id_value: [16]u8 = undefined;
207 var scope_id_value: [os.IFNAMESIZE - 1]u8 = undefined;
208208 var scope_id_index: usize = 0;
209209
210210 for (buf) |c, i| {
......@@ -215,6 +215,10 @@ pub const Address = extern union {
215215 (c >= 'a' and c <= 'z') or
216216 (c == '-') or (c == '.') or (c == '_') or (c == '~'))
217217 {
218 if (scope_id_index >= scope_id_value.len) {
219 return error.Overflow;
220 }
221
218222 scope_id_value[scope_id_index] = c;
219223 scope_id_index += 1;
220224 } else {