diff --git a/plugins/cachekey/cachekey.cc b/plugins/cachekey/cachekey.cc index 5f128894bfa..44925b3db28 100644 --- a/plugins/cachekey/cachekey.cc +++ b/plugins/cachekey/cachekey.cc @@ -41,7 +41,7 @@ appendEncoded(String &target, const char *s, size_t len) return; } - char tmp[len * 2]; + char tmp[len * 3 + 1]; size_t written; /* The default table does not encode the comma, so we need to use our own table here. */ diff --git a/proxy/logging/LogUtils.cc b/proxy/logging/LogUtils.cc index 94becf250ac..475bee87cad 100644 --- a/proxy/logging/LogUtils.cc +++ b/proxy/logging/LogUtils.cc @@ -343,7 +343,7 @@ escapify_url_common(Arena *arena, char *url, size_t len_in, int *len_out, char * // size_t out_len = len_in + 2 * count; - if (dst && out_len > dst_size) { + if (dst && (out_len + 1) > dst_size) { *len_out = 0; return nullptr; }