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

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