diff options
author | Berke Viktor <berkeviktor@aol.com> | 2012-01-20 00:38:57 +0100 |
---|---|---|
committer | Berke Viktor <berkeviktor@aol.com> | 2012-01-20 00:38:57 +0100 |
commit | a9fb6a18ecaff6b2f39a4710677385557af15924 (patch) | |
tree | e84d891548c2e6d2e29bc1a9bc0793abede88bb5 /src/common/server.c | |
parent | beac798c6e014b409b75e48104e79331b5c3df53 (diff) |
initial patch for filtering malicious characters on win32 (Khisanth)
Diffstat (limited to 'src/common/server.c')
-rw-r--r-- | src/common/server.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/common/server.c b/src/common/server.c index cdd67cda..53e877e3 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -310,6 +310,11 @@ server_inline (server *serv, char *line, int len) { char *utf_line_allocated = NULL; +#ifdef WIN32 + char *cleaned_line; + int cleaned_len; +#endif + /* Checks whether we're set to use UTF-8 charset */ if (serv->using_irc || /* 1. using CP1252/UTF-8 Hybrid */ (serv->encoding == NULL && prefs.utf8_locale) || /* OR 2. using system default->UTF-8 */ @@ -396,12 +401,24 @@ server_inline (server *serv, char *line, int len) } } +#ifdef WIN32 + cleaned_line = text_replace_non_bmp (line, len, &cleaned_len); + if (cleaned_line != NULL ) { + line = cleaned_line; + len = cleaned_len; + } +#endif + fe_add_rawlog (serv, line, len, FALSE); url_check_line (line, len); /* let proto-irc.c handle it */ serv->p_inline (serv, line, len); +#ifdef WIN32 + g_free (cleaned_line); +#endif + if (utf_line_allocated != NULL) /* only if a special copy was allocated */ g_free (utf_line_allocated); } |