Commit 64e55a74de
Changed files (1)
lib
std
lib/std/net.zig
@@ -209,8 +209,17 @@ pub const Address = extern union {
for (buf) |c, i| {
if (scope_id) {
- scope_id_value[scope_id_index] = c;
- scope_id_index += 1;
+ // Handling of percent-encoding should be for an URI library.
+ if ((c >= '0' and c <= '9') or
+ (c >= 'A' and c <= 'Z') or
+ (c >= 'a' and c <= 'z') or
+ (c == '-') or (c == '.') or (c == '_') or (c == '~'))
+ {
+ scope_id_value[scope_id_index] = c;
+ scope_id_index += 1;
+ } else {
+ return error.InvalidCharacter;
+ }
} else if (c == ':') {
if (!saw_any_digits) {
if (abbrv) return error.InvalidCharacter; // ':::'
@@ -272,6 +281,10 @@ pub const Address = extern union {
return error.Incomplete;
}
+ if (scope_id and scope_id_index == 0) {
+ return error.Incomplete;
+ }
+
var resolved_scope_id: u32 = 0;
if (scope_id_index > 0) {
const scope_id_str = scope_id_value[0..scope_id_index];