]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Check string length to avoid OOB reading
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 16 Jan 2020 12:55:24 +0000 (12:55 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 16 Jan 2020 12:55:46 +0000 (12:55 +0000)
src/libutil/ssl_util.c

index f2898d5927526016c046372c8c246ae2c7c7ebfa..c43ace45453cb7749cb2d48f0451da1945a646a6 100644 (file)
@@ -401,7 +401,7 @@ rspamd_tls_set_error (gint retcode, const gchar *stage, GError **err)
 
                err_code = last_err;
 
-               if (reason->str[reason->len - 1] == ',') {
+               if (reason->len > 0 && reason->str[reason->len - 1] == ',') {
                        reason->str[reason->len - 1] = '\0';
                        reason->len --;
                }