~ubuntu-branches/ubuntu/utopic/pidgin-latex/utopic

« back to all changes in this revision

Viewing changes to debian/patches/01_security_issue.patch

  • Committer: Package Import Robot
  • Author(s): Elías Alejandro Año Mendoza
  • Date: 2013-04-03 14:57:08 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130403145708-p59okofl55d3czqd
Tags: 1.5.0-1
* New upstream release
* Updated Standards-Version to 3.9.4 
* Bump debhelper compat to 9
* Upstream fixed background color in rendered images (Closes: #699009)
* debian/copyright
  + Updated copyright format
* debian/rules
  + Append CPPFLAGS to CFLAGS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: pidgin-latex has a security issue to get into makeatletter-mode.
2
 
 This patch fix insufficient validation of LaTeX code and avoid send
3
 
 messages over a messenger network to a user local system account 
4
 
 information.
5
 
 
6
 
Author: Benjamin Moll <qjuh@users.sourceforge.net>
7
 
Forwarded: no
8
 
Last-Update: 2012-07-23 
9
 
 
10
 
--- pidgin-latex-1.4.4.orig/LaTeX.c     2011-01-12 19:28:45.000000000 -0500
11
 
+++ pidgin-latex-1.4.4/LaTeX.c  2012-08-25 20:27:55.000000000 -0500
12
 
@@ -36,6 +36,7 @@
13
 
 #include <string.h>
14
 
 #include <unistd.h>
15
 
 #include <errno.h>
16
 
+#include <regex.h>
17
 
 #include <sys/types.h>
18
 
 
19
 
 #ifndef _WIN32
20
 
@@ -321,14 +322,21 @@
21
 
 static gboolean is_blacklisted(char *message)
22
 
 {
23
 
   char *not_secure[NB_BLACKLIST] = BLACKLIST;
24
 
+  int reti;
25
 
   int i;
26
 
   for (i = 0 ; i < NB_BLACKLIST ; i++)
27
 
   {
28
 
-    char *begin_not_secure = malloc((strlen(not_secure[i])+9)*sizeof(char));
29
 
-    strcpy(begin_not_secure,"\\begin{");
30
 
+    regex_t regex;
31
 
+    char *begin_not_secure = malloc((strlen(not_secure[i])+18)*sizeof(char));
32
 
+    strcpy(begin_not_secure,"\\\\begin\\W*{\\W*");
33
 
     strcat(begin_not_secure,not_secure[i]+0x01);
34
 
-    strcat(begin_not_secure,"}");
35
 
-    if (strstr(message, not_secure[i]) != NULL || strstr(message, begin_not_secure)) return TRUE;
36
 
+    strcat(begin_not_secure,"\\W*}");
37
 
+    reti = regcomp(&regex, begin_not_secure, 0);
38
 
+purple_debug_info("LaTeX", "RegEx-Comp: %s (%d)\n", begin_not_secure, reti);
39
 
+    reti = regexec(&regex, message, 0, NULL, 0);
40
 
+    regfree(&regex);
41
 
+purple_debug_info("LaTeX", "Blacklist: %s und %s (RegEx-Match: %d)\n", not_secure[i], begin_not_secure, reti);
42
 
+    if (strstr(message, not_secure[i]) != NULL || reti!=REG_NOMATCH) return TRUE;
43
 
   }
44
 
   return FALSE;
45
 
 }