hc
2024-11-01 a01b5c9f91adaee088a817861603a5dbe14775c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From ac286a71ed78429e16c612161251b9ea90ccd431 Mon Sep 17 00:00:00 2001
From: Paul <paul@claws-mail.org>
Date: Sun, 23 May 2021 12:16:40 +0100
Subject: [PATCH] harden link checker before accepting click
 
[Retrieved from:
https://git.claws-mail.org/?p=claws.git;a=commit;h=ac286a71ed78429e16c612161251b9ea90ccd431]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 src/textview.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
 
diff --git a/src/textview.c b/src/textview.c
index 62ad46eaf..3cdf5d911 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -2885,7 +2885,7 @@ gboolean textview_uri_security_check(TextView *textview, ClickableText *uri)
     gboolean retval = TRUE;
 
     if (is_uri_string(uri->uri) == FALSE)
-        return TRUE;
+        return FALSE;
 
     visible_str = textview_get_visible_uri(textview, uri);
     if (visible_str == NULL)
@@ -2922,6 +2922,8 @@ gboolean textview_uri_security_check(TextView *textview, ClickableText *uri)
         if (aval == G_ALERTALTERNATE)
             retval = TRUE;
     }
+    if (strlen(uri->uri) > get_uri_len(uri->uri))
+        retval = FALSE;
 
     g_free(visible_str);
 
-- 
2.25.1