From b3ab978703e0597b4bdf17d3e32cf0357db8315c Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Sun, 13 Nov 2022 22:55:58 +0100 Subject: [PATCH] package/libvncserver: fix CVE-2020-29260 libvncclient v0.9.13 was discovered to contain a memory leak via the function rfbClientCleanup(). Signed-off-by: Fabrice Fontaine Signed-off-by: Thomas Petazzoni --- ...ee-vncRec-memory-in-rfbClientCleanup.patch | 28 +++++++++++++++++++ package/libvncserver/libvncserver.mk | 3 ++ 2 files changed, 31 insertions(+) create mode 100644 package/libvncserver/0002-libvncclient-free-vncRec-memory-in-rfbClientCleanup.patch diff --git a/package/libvncserver/0002-libvncclient-free-vncRec-memory-in-rfbClientCleanup.patch b/package/libvncserver/0002-libvncclient-free-vncRec-memory-in-rfbClientCleanup.patch new file mode 100644 index 0000000000..7658c112f3 --- /dev/null +++ b/package/libvncserver/0002-libvncclient-free-vncRec-memory-in-rfbClientCleanup.patch @@ -0,0 +1,28 @@ +From bef41f6ec4097a8ee094f90a1b34a708fbd757ec Mon Sep 17 00:00:00 2001 +From: Christian Beier +Date: Sat, 21 Nov 2020 12:52:31 +0100 +Subject: [PATCH] libvncclient: free vncRec memory in rfbClientCleanup() + +Otherwise we leak memory. Spotted by Ramin Farajpour Cami +, thanks! + +[Retrieved from: +https://github.com/LibVNC/libvncserver/commit/bef41f6ec4097a8ee094f90a1b34a708fbd757ec] +Signed-off-by: Fabrice Fontaine +--- + libvncclient/vncviewer.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c +index d6b91f02b..0a1bdcf6a 100644 +--- a/libvncclient/vncviewer.c ++++ b/libvncclient/vncviewer.c +@@ -534,6 +534,8 @@ void rfbClientCleanup(rfbClient* client) { + client->clientData = next; + } + ++ free(client->vncRec); ++ + if (client->sock != RFB_INVALID_SOCKET) + rfbCloseSocket(client->sock); + if (client->listenSock != RFB_INVALID_SOCKET) diff --git a/package/libvncserver/libvncserver.mk b/package/libvncserver/libvncserver.mk index ead809d19c..8f24e2d098 100644 --- a/package/libvncserver/libvncserver.mk +++ b/package/libvncserver/libvncserver.mk @@ -14,6 +14,9 @@ LIBVNCSERVER_INSTALL_STAGING = YES LIBVNCSERVER_DEPENDENCIES = host-pkgconf lzo LIBVNCSERVER_CONF_OPTS = -DWITH_LZO=ON +# 0002-libvncclient-free-vncRec-memory-in-rfbClientCleanup.patch +LIBVNCSERVER_IGNORE_CVES += CVE-2020-29260 + # only used for examples LIBVNCSERVER_CONF_OPTS += \ -DWITH_FFMPEG=OFF \