[network-name] implement additional validation rules (#6988)

According to SPEC-981, we need to verify 3 more things while setting a
network name:
- The name length >= 1.
- There are no UTF control characters in the name.
- There are no UTF NUL characters in the name. This is covered by the
  second rule.
This commit is contained in:
whd
2021-09-09 15:41:06 -07:00
committed by GitHub
parent 7563ee8d1d
commit e2f0afab5d
5 changed files with 8 additions and 1 deletions
+2
View File
@@ -138,6 +138,8 @@ void TestUtf8(void)
VerifyOrQuit(!IsValidUtf8String("\xef\x80"));
VerifyOrQuit(!IsValidUtf8String("\xf7\x80\x80"));
VerifyOrQuit(!IsValidUtf8String("\xff"));
VerifyOrQuit(!IsValidUtf8String("NUL\x00NUL", 7)); // UTF-8 NUL
VerifyOrQuit(!IsValidUtf8String("abcde\x11")); // control character
printf(" -- PASS\n");
}