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

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