mghttpd/mongoose: Fix string truncation warning

This fixes the compiler warning below.

../../../cpukit/mghttpd/mongoose.c:1919:45: warning:
'.gz' directive output may be truncated writing 3 bytes into a region
of size between 1 and 255 [-Wformat-truncation=]
This commit is contained in:
Frank Kühndel
2020-10-06 15:01:31 +02:00
committed by Sebastian Huber
parent bc7ac71f8a
commit c8c1426c68

View File

@@ -1887,7 +1887,7 @@ static void convert_uri_to_file_name(struct mg_connection *conn, char *buf,
*root = conn->ctx->config[DOCUMENT_ROOT]; *root = conn->ctx->config[DOCUMENT_ROOT];
char *p; char *p;
int match_len; int match_len;
char gz_path[PATH_MAX]; char gz_path[PATH_MAX + 3];
char const* accept_encoding; char const* accept_encoding;
// Using buf_len - 1 because memmove() for PATH_INFO may shift part // Using buf_len - 1 because memmove() for PATH_INFO may shift part
@@ -3021,7 +3021,7 @@ static void handle_file_request(struct mg_connection *conn, const char *path,
int64_t cl, r1, r2; int64_t cl, r1, r2;
struct vec mime_vec; struct vec mime_vec;
int n; int n;
char gz_path[PATH_MAX]; char gz_path[PATH_MAX + 3];
char const* encoding = ""; char const* encoding = "";
get_mime_type(conn->ctx, path, &mime_vec); get_mime_type(conn->ctx, path, &mime_vec);