new file mode 100644
@@ -0,0 +1,75 @@
+From 27f07d414949259f17aebc02a61f103629d547f1 Mon Sep 17 00:00:00 2001
+From: npt-1707 <npthanh132@gmail.com>
+Date: Tue, 10 Mar 2026 00:19:33 +0800
+Subject: [PATCH] Fix CVE-2018-19387
+
+(cherry picked from commit 3e12f558c7b71b7135403cdd2df77d38538a695c)
+
+CVE: CVE-2026-4751
+Upstream-Status: Backport [https://github.com/tmate-io/tmate/commit/3e12f558c7b71b7135403cdd2df77d38538a695c]
+Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
+---
+ format.c | 2 ++
+ input.c | 2 ++
+ server-client.c | 6 ++++++
+ window.c | 2 ++
+ 4 files changed, 12 insertions(+)
+
+diff --git a/format.c b/format.c
+index f771c85f..3bbb8cf1 100644
+--- a/format.c
++++ b/format.c
+@@ -468,6 +468,8 @@ format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe)
+ return;
+
+ buffer = evbuffer_new();
++ if (buffer == NULL)
++ fatalx("out of memory");
+ for (i = 0; i < wp->base.grid->sx; i++) {
+ if (!bit_test(wp->base.tabs, i))
+ continue;
+diff --git a/input.c b/input.c
+index 18c8eb9a..8a66d89e 100644
+--- a/input.c
++++ b/input.c
+@@ -766,6 +766,8 @@ input_init(struct window_pane *wp)
+ ictx->input_buf = xmalloc(INPUT_BUF_START);
+
+ ictx->since_ground = evbuffer_new();
++ if (ictx->since_ground == NULL)
++ fatalx("out of memory");
+
+ input_reset(wp, 0);
+ }
+diff --git a/server-client.c b/server-client.c
+index 21cccc85..e8614d40 100644
+--- a/server-client.c
++++ b/server-client.c
+@@ -121,8 +121,14 @@ server_client_create(int fd)
+ c->cmdq->client_exit = 1;
+
+ c->stdin_data = evbuffer_new();
++ if (c->stdin_data == NULL)
++ fatalx("out of memory");
+ c->stdout_data = evbuffer_new();
++ if (c->stdout_data == NULL)
++ fatalx("out of memory");
+ c->stderr_data = evbuffer_new();
++ if (c->stderr_data == NULL)
++ fatalx("out of memory");
+
+ c->tty.fd = -1;
+ c->title = NULL;
+diff --git a/window.c b/window.c
+index 45ec7790..9d95bb77 100644
+--- a/window.c
++++ b/window.c
+@@ -945,6 +945,8 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
+
+ wp->event = bufferevent_new(wp->fd, window_pane_read_callback, NULL,
+ window_pane_error_callback, wp);
++ if (wp->event == NULL)
++ fatalx("out of memory");
+
+ bufferevent_setwatermark(wp->event, EV_READ, 0, READ_SIZE);
+ bufferevent_enable(wp->event, EV_READ|EV_WRITE);
@@ -8,6 +8,7 @@ DEPENDS:append = " libevent libssh msgpack-c ncurses"
SRC_URI = "\
git://github.com/tmate-io/tmate.git;protocol=https;branch=master \
file://0001-fix-finding-msgpack.patch \
+ file://CVE-2026-4751.patch \
"
SRCREV = "5e00bfa5e137e76c81888727712ced2b3fd99f5b"