diff options
author | Maria Matejka <mq@ucw.cz> | 2019-08-14 12:29:04 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2020-05-01 15:19:12 +0200 |
commit | a1b61a271af40a9d6ef0837424ab2c98d29f1575 (patch) | |
tree | 7f12d374e2ee2efd04147b43a3281997d52f3787 /lib/ip.c | |
parent | d65a926a67749f8e8ffb6df9b3e2e123669b0656 (diff) |
IPv6 address parser: fail on incomplete addresses
Diffstat (limited to 'lib/ip.c')
-rw-r--r-- | lib/ip.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -264,6 +264,9 @@ ip6_pton(const char *a, ip6_addr *o) int i, j, k, l, hfil; const char *start; + if (!a[0]) /* Empty string check */ + return 0; + if (a[0] == ':') /* Leading :: */ { if (a[1] != ':') @@ -333,6 +336,8 @@ ip6_pton(const char *a, ip6_addr *o) for (; i>=hfil; i--) words[i] = 0; } + else if (i != 8) /* Incomplete address */ + return 0; /* Convert the address to ip6_addr format */ for (i=0; i<4; i++) |