diff options
author | Andy Green <andy@warmcat.com> | 2021-09-14 05:58:53 +0100 |
---|---|---|
committer | Andy Green <andy@warmcat.com> | 2021-10-05 07:09:55 +0100 |
commit | d069098683099c4c025d7525c949a2d3b45ea556 (patch) | |
tree | c7155093847688962d5256f885e080f7f0d1acec | |
parent | b6004e08c93b9b06c1a9980fe60814964499b0ad (diff) | |
download | libwebsockets-d069098683099c4c025d7525c949a2d3b45ea556.tar.gz |
conmon: async-dns: off-by-one
-rw-r--r-- | lib/core-net/client/conmon.c | 2 | ||||
-rw-r--r-- | lib/system/async-dns/async-dns-parse.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/core-net/client/conmon.c b/lib/core-net/client/conmon.c index 0fb716bd..21f67c96 100644 --- a/lib/core-net/client/conmon.c +++ b/lib/core-net/client/conmon.c @@ -96,7 +96,7 @@ lws_conmon_append_copy_new_dns_results(struct lws *wsi, size_t cl = cai->ai_canonname ? strlen(cai->ai_canonname) + 1 : 0; - ai = lws_malloc(al + cl, __func__); + ai = lws_malloc(al + cl + 1, __func__); if (!ai) { lwsl_wsi_warn(wsi, "OOM"); return 1; diff --git a/lib/system/async-dns/async-dns-parse.c b/lib/system/async-dns/async-dns-parse.c index cc9693ab..17e95aa2 100644 --- a/lib/system/async-dns/async-dns-parse.c +++ b/lib/system/async-dns/async-dns-parse.c @@ -603,7 +603,7 @@ lws_adns_parse_udp(lws_async_dns_t *dns, const uint8_t *pkt, size_t len) lwsl_info("%s: create cache entry for %s, %zu\n", __func__, nm, est - sizeof(lws_adns_cache_t)); - c = lws_malloc(est, "async-dns-entry"); + c = lws_malloc(est + 1, "async-dns-entry"); if (!c) { lwsl_err("%s: OOM %zu\n", __func__, est); goto fail_out; |