Blame SOURCES/0002-libssh2-1.8.0-CVE-2019-3856.patch

0b3366
From cc573aafb6f4b24bce9b82f308e92b9723a73024 Mon Sep 17 00:00:00 2001
0b3366
From: Kamil Dudka <kdudka@redhat.com>
0b3366
Date: Tue, 19 Mar 2019 13:22:24 +0100
0b3366
Subject: [PATCH] Resolves: CVE-2019-3856 - fix integer overflow in keyboard
0b3366
 interactive handling
0b3366
0b3366
... resulting in out of bounds write
0b3366
0b3366
Upstream-Patch: https://libssh2.org/1.8.0-CVE/CVE-2019-3856.patch
0b3366
0b3366
I believe that:
0b3366
0b3366
    `(session->userauth_kybd_num_prompts && session->userauth_kybd_num_prompts > 100)`
0b3366
0b3366
... can be simplified as:
0b3366
0b3366
    `(session->userauth_kybd_num_prompts > 100)`
0b3366
0b3366
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
0b3366
---
0b3366
 src/userauth.c | 7 +++++++
0b3366
 1 file changed, 7 insertions(+)
0b3366
0b3366
diff --git a/src/userauth.c b/src/userauth.c
0b3366
index cdfa25e..3946cf9 100644
0b3366
--- a/src/userauth.c
0b3366
+++ b/src/userauth.c
0b3366
@@ -1734,6 +1734,13 @@ userauth_keyboard_interactive(LIBSSH2_SESSION * session,
0b3366
             /* int       num-prompts */
0b3366
             session->userauth_kybd_num_prompts = _libssh2_ntohu32(s);
0b3366
             s += 4;
0b3366
+            if(session->userauth_kybd_num_prompts && 
0b3366
+               session->userauth_kybd_num_prompts > 100) {
0b3366
+               _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY,
0b3366
+                              "Too many replies for "
0b3366
+                              "keyboard-interactive prompts");
0b3366
+               goto cleanup;
0b3366
+            }
0b3366
 
0b3366
             if(session->userauth_kybd_num_prompts) {
0b3366
                 session->userauth_kybd_prompts =
0b3366
-- 
0b3366
2.17.2
0b3366