diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-03-14 12:13:55 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-03-16 00:01:53 +0000 |
commit | 2fb706f9a842474e534e7c6e2915d9096f5a10d1 (patch) | |
tree | e815c303889992d947c27a55d69274fc023d1f2b /src/corelib/io/qipaddress.cpp | |
parent | 53f82185e9320e0561d5a424d7145aadc18cca30 (diff) |
QIpAddress: reject IPv6 addresses with more than 4 hex digits
Matches glibc commit 9a0cc8c1bd7645bf3c988890ffb59639c07a5812.
[ChangeLog][QtCore][QUrl] Fixed a bug in parsing IPv6 addresses with
more than 4 hex digits in a component.
[ChangeLog][QtNetwork][QHostAddress] Fixed a bug in parsing IPv6
addresses with more than 4 hex digits in a component.
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=9a0cc8c1bd7645bf3c988890ffb59639c07a5812
Change-Id: I2701038131d91eb108aebb3bec16278e4efe3de2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/corelib/io/qipaddress.cpp')
-rw-r--r-- | src/corelib/io/qipaddress.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qipaddress.cpp b/src/corelib/io/qipaddress.cpp index 02b12f635a..039e291b43 100644 --- a/src/corelib/io/qipaddress.cpp +++ b/src/corelib/io/qipaddress.cpp @@ -216,7 +216,10 @@ const QChar *parseIp6(IPv6Address &address, const QChar *begin, const QChar *end quint64 ll = qstrtoull(ptr, &endptr, 16, &ok); quint16 x = ll; - if (!ok || ll != x) + // Reject malformed fields: + // - failed to parse + // - too many hex digits + if (!ok || endptr > ptr + 4) return begin + (ptr - buffer.data()); if (*endptr == '.') { |