[glib/wip/issue2323-2-66: 4/5] gtlspassword: Fix inverted assertion




commit 4506d1859a863087598c8d122740bae25b65b099
Author: Simon McVittie <smcv collabora com>
Date:   Mon Feb 8 10:04:48 2021 +0000

    gtlspassword: Fix inverted assertion
    
    The intention here was to assert that the length of the password fits
    in a gssize. Passwords more than half the size of virtual memory are
    probably excessive.
    
    Fixes: a8b204ff "gtlspassword: Forbid very long TLS passwords"
    Signed-off-by: Simon McVittie <smcv collabora com>
    (cherry picked from commit 61bb52ec42de1082bfb06ce1c737fc295bfe60b8)

 gio/gtlspassword.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/gtlspassword.c b/gio/gtlspassword.c
index dbcec41a8..bd86a6dfe 100644
--- a/gio/gtlspassword.c
+++ b/gio/gtlspassword.c
@@ -291,7 +291,7 @@ g_tls_password_set_value (GTlsPassword  *password,
     {
       /* FIXME: g_tls_password_set_value_full() doesn’t support unsigned gsize */
       gsize length_unsigned = strlen ((gchar *) value);
-      g_return_if_fail (length_unsigned > G_MAXSSIZE);
+      g_return_if_fail (length_unsigned <= G_MAXSSIZE);
       length = (gssize) length_unsigned;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]