prevent out of bounds access when checking IDNA host label

This commit is contained in:
Vincent Sanders 2019-06-13 17:02:08 +01:00
parent 1951c0f809
commit 8b6f590aaa
1 changed files with 1 additions and 1 deletions

View File

@ -437,7 +437,7 @@ static bool idna__is_valid(int32_t *label, size_t len)
*/
/* 2. Check characters 3 and 4 are not '--'. */
if ((label[2] == 0x002d) && (label[3] == 0x002d)) {
if ((len >= 4) && (label[2] == 0x002d) && (label[3] == 0x002d)) {
NSLOG(netsurf, INFO,
"Check failed: characters 2 and 3 are '--'");
return false;