Skip to content

Commit c80f2fa

Browse files
committed
Fix Dynamic Allocation
1 parent 8433878 commit c80f2fa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/webui.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ static WEBUI_THREAD_MONITOR;
634634
#define WEBUI_FILE_OPEN(file, filename, mode) fopen_s(&file, filename, mode)
635635
#define WEBUI_SN_PRINTF_DYN(buffer, buffer_size, format, ...) snprintf(buffer, buffer_size, format, ##__VA_ARGS__)
636636
#define WEBUI_SN_PRINTF_STATIC(buffer, buffer_size, format, ...) snprintf(buffer, buffer_size, format, ##__VA_ARGS__)
637-
#define WEBUI_STR_COPY_DYN(dest, dest_size, src) strcpy_s(dest, dest_size, src)
637+
#define WEBUI_STR_COPY_DYN(dest, dest_size, src) strcpy_s(dest, (dest_size + 1), src)
638638
#define WEBUI_STR_COPY_STATIC(dest, dest_size, src) strcpy_s(dest, dest_size, src)
639639
#define WEBUI_STR_CAT_DYN(dest, dest_size, src) strcat_s(dest, dest_size, src)
640640
#define WEBUI_STR_CAT_STATIC(dest, dest_size, src) strcat_s(dest, dest_size, src)
@@ -8054,6 +8054,12 @@ static int _webui_http_handler(struct mg_connection* client, void * _win) {
80548054
printf("[Core]\t\t_webui_http_handler() -> Embedded Index HTML\n");
80558055
#endif
80568056

8057+
#ifdef WEBUI_LOG
8058+
printf("---[ HTML (%zu bytes)]--------------\n", _webui_strlen(win->html));
8059+
printf("%s\n", win->html);
8060+
printf("------------------------------------\n");
8061+
#endif
8062+
80578063
// Send 200
80588064
_webui_http_send(win, client, "text/html", win->html, _webui_strlen(win->html), false);
80598065
}

0 commit comments

Comments
 (0)