[gtk-vnc] Protect against divide by zero in MSLogon auth
- From: Daniel P. Berrange <dberrange src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] Protect against divide by zero in MSLogon auth
- Date: Fri, 17 Aug 2018 10:22:35 +0000 (UTC)
commit f0fc819ae879f449c8d5dcb09ee623f4df15ed82
Author: Daniel P. Berrangé <berrange redhat com>
Date: Fri Aug 17 11:18:52 2018 +0100
Protect against divide by zero in MSLogon auth
Signed-off-by: Daniel P. Berrangé <berrange redhat com>
src/vncconnection.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index a2fa1da..5c03d70 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -3768,6 +3768,8 @@ static gboolean vnc_connection_perform_auth_mslogon(VncConnection *conn)
gcry_mpi_t genmpi, modmpi, respmpi, pubmpi, keympi;
guchar username[256], password[64];
guint passwordLen, usernameLen;
+ gboolean allzeroes = TRUE;
+ int i;
VNC_DEBUG("Do Challenge");
priv->want_cred_password = TRUE;
@@ -3783,6 +3785,18 @@ static gboolean vnc_connection_perform_auth_mslogon(VncConnection *conn)
if (vnc_connection_has_error(conn))
return FALSE;
+ /* If 'mod' is bogus all-zeros when we get a divide by zero
+ * so sanity check that */
+ for (i = 0; i < 8; i++) {
+ if (mod[i])
+ allzeroes = FALSE;
+ }
+ if (allzeroes) {
+ vnc_connection_set_error(conn, "%s",
+ "Bad DH modulus value");
+ return FALSE;
+ }
+
genmpi = vnc_bytes_to_mpi(gen,sizeof(gen));
modmpi = vnc_bytes_to_mpi(mod,sizeof(mod));
respmpi = vnc_bytes_to_mpi(resp,sizeof(resp));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]