summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-06-09 18:51:12 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2017-06-09 18:51:12 (GMT)
commit2467a0a99080c0d707fcf443a2d91deed1a76c1d (patch)
treea8e891646769b07c3bbe53908a1c2c00545ae4bd
parent703427a48612bf98fba599dfcd6e91485efd5b77 (diff)
downloadnetsurf-2467a0a99080c0d707fcf443a2d91deed1a76c1d.tar.gz
netsurf-2467a0a99080c0d707fcf443a2d91deed1a76c1d.tar.bz2
fix coverity issue 1372473 Out-of-bounds write
-rw-r--r--content/urldb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/content/urldb.c b/content/urldb.c
index f553368..313ec31 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -696,8 +696,8 @@ static bool urldb__host_is_ip_address(const char *host)
}
ipv6_addr_len = host_len - 2;
- if (ipv6_addr_len > sizeof(ipv6_addr)) {
- ipv6_addr_len = sizeof(ipv6_addr);
+ if (ipv6_addr_len >= sizeof(ipv6_addr)) {
+ ipv6_addr_len = sizeof(ipv6_addr) - 1;
}
strncpy(ipv6_addr, sane_host + 1, ipv6_addr_len);
ipv6_addr[ipv6_addr_len] = '\0';