commit c219213: [Minor] Fix logic of finding slashless urls

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 25 18:35:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-02-25 18:32:15 +0000
URL: https://github.com/rspamd/rspamd/commit/c219213d989f1863554280e4cb9d76676a19f6f2 (HEAD -> master)

[Minor] Fix logic of finding slashless urls

---
 src/libserver/html.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/libserver/html.c b/src/libserver/html.c
index 6840b9a1a..31438ddad 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -1366,21 +1366,24 @@ rspamd_html_process_url (rspamd_mempool_t *pool, const gchar *start, guint len,
 						dlen += sizeof ("mailto://") - 1;
 						no_prefix = TRUE;
 					}
+					else if (s[i] == ':' && i != 0) {
+						/* Special case */
+						no_prefix = FALSE;
+					}
 					else {
 						if (i == 0) {
 							/* No valid data */
 							return NULL;
 						}
+						else {
+							no_prefix = TRUE;
+							dlen += strlen (prefix);
+						}
 					}
 
 					break;
 				}
 			}
-
-			if (!no_prefix) {
-				no_prefix = TRUE;
-				dlen += strlen (prefix);
-			}
 		}
 	}
 


More information about the Commits mailing list