libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 56148bb5e20a6355c6c53351be783b5e040bfccb
parent 4e5537f325d89be60fba9c89b7224205f03bc09c
Author: Evgeny Grin <k2k@drgrin.dev>
Date:   Fri,  2 May 2025 19:41:34 +0300

demo.c: fixed compiler warnings + fixed buffers sizes

Diffstat:
Msrc/examples2/demo.c | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/examples2/demo.c b/src/examples2/demo.c @@ -286,7 +286,7 @@ static bool list_directory (struct ResponseDataContext *rdc, const char *dirname) { - char fullname[PATH_MAX]; + char fullname[PATH_MAX + 1]; struct stat sbuf; DIR *dir; struct dirent *de; @@ -463,7 +463,7 @@ struct UploadContext /** * Name of our temporary file where we initially read to. */ - char tmpname[PATH_MAX]; + char tmpname[PATH_MAX + 1]; /** * Name of the file on disk. @@ -725,7 +725,7 @@ done_cb (struct MHD_Request *req, const struct MHD_UploadAction *ret; const struct MHD_StringNullable *cat; const struct MHD_StringNullable *lang; - char fn[PATH_MAX]; + char fn[PATH_MAX + 1]; int res; if (MHD_POST_PARSE_RES_OK != parsing_result) @@ -917,10 +917,11 @@ generate_page (void *cls, ssize_t got; #endif /* MHD_HAVE_LIBMAGIC */ const char *mime; - int fd = -1; + int fd; struct stat buf; fd = -1; + buf.st_size = 0; /* Mute compiler warning */ if ( (NULL == strstr (&url[1], "..")) && ('/' != url[1]) )