libssh2: fix CVE-2020-22218

(From OE-Core rev: a0b41511766130883e93b5b8a07801a836beeb67)

Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Chee Yang Lee
2023-09-04 18:03:10 +08:00
committed by Steve Sakoman
parent 4c27009f16
commit 91ea1ab7c6
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
CVE: CVE-2020-22218
Upstream-Status: Backport [ https://github.com/libssh2/libssh2/commit/642eec48ff3adfdb7a9e562b6d7fc865d1733f45 ]
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
From 642eec48ff3adfdb7a9e562b6d7fc865d1733f45 Mon Sep 17 00:00:00 2001
From: lutianxiong <lutianxiong@huawei.com>
Date: Fri, 29 May 2020 01:25:40 +0800
Subject: [PATCH] transport.c: fix use-of-uninitialized-value (#476)
file:transport.c
notes:
return error if malloc(0)
credit:
lutianxiong
---
src/transport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/transport.c b/src/transport.c
index 96fca6b8cc..adf96c2437 100644
--- a/src/transport.c
+++ b/src/transport.c
@@ -472,7 +472,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
/* Get a packet handle put data into. We get one to
hold all data, including padding and MAC. */
p->payload = LIBSSH2_ALLOC(session, total_num);
- if(!p->payload) {
+ if(total_num == 0 || !p->payload) {
return LIBSSH2_ERROR_ALLOC;
}
p->total_num = total_num;

View File

@@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=3e089ad0cf27edf1e7f261dfcd06acc7"
SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz \
file://fix-ssh2-test.patch \
file://run-ptest \
file://CVE-2020-22218.patch \
"
SRC_URI[sha256sum] = "2d64e90f3ded394b91d3a2e774ca203a4179f69aebee03003e5a6fa621e41d51"