Mercurial > pidgin.yaz
annotate libpurple/sound-theme.h @ 30702:6829b27ee4c8
This patch attempts to fix four bugs in the oscar protocol plugin that
were introduced with the X-Status code in Pidgin 2.7.0.
Problem #1 (the remotely-triggerable crash):
The crash happens when a buddy sets an xstatus message containing <desc>
but no closing </desc>, or <title> but no closing </title>. The fix
is to check the result of strstr(closing_tag_name) and do nothing if it
is NULL. This is CVE-2010-2528.
Problem #2:
Fixes potential incorrect parsing of the xstatus string that could result
in an incorrect message being displayed to the libpurple user. Happens if
an xstatus message contains </desc> before <desc>, or </title> before
<title>. The fix is to start looking for the closing tag at the end
of the beginning tag rather than at the beginning of the xstatus xml.
Probably not a security problem, but definitely a bug.
Problem #3:
Fixes potential incorrect parsing of the xstatus string that could result
in the title not being shown to the libpurple user. Happens if the close
title tag appears after the desc tag in the xstatus xml, because we add a
null character at the beginning of the close title tag, so strstr() for
the desc tag would stop searching there. Probably not a security problem,
but definitely a bug.
Problem #4:
Fixes potential incorrect display of the xstatus string that could result
in an incorrect message being displayed to the libpurple user. Happens
because we reusing the 'xml' string when preparing the string for the user,
but we copy values from xml to xml. If those values overlap with themselves
or with each other then an incorrect value could be displayed. Probably not
a security problem, but definitely a bug.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 21 Jul 2010 02:49:23 +0000 |
parents | b1c8ffbd48f9 |
children | 4d92a431d0a1 |
rev | line source |
---|---|
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
1 /** |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
2 * @file sound-theme.h Purple Sound Theme Abstact Class API |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
3 */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
4 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
5 /* purple |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
6 * |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
7 * Purple is the legal property of its developers, whose names are too numerous |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
9 * source distribution. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
10 * |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
14 * (at your option) any later version. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
15 * |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
19 * GNU General Public License for more details. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
20 * |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
24 */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
25 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
26 #ifndef PURPLE_SOUND_THEME_H |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
27 #define PURPLE_SOUND_THEME_H |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
28 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
29 #include <glib.h> |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
30 #include <glib-object.h> |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
31 #include "theme.h" |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
32 #include "sound.h" |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
33 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
34 /** |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
35 * extends PurpleTheme (theme.h) |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
36 * A purple sound theme. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
37 * This is an object for Purple to represent a sound theme. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
38 * |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
39 * PurpleSoundTheme is a PurpleTheme Object. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
40 */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
41 typedef struct _PurpleSoundTheme PurpleSoundTheme; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
42 typedef struct _PurpleSoundThemeClass PurpleSoundThemeClass; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
43 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
44 #define PURPLE_TYPE_SOUND_THEME (purple_sound_theme_get_type()) |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
45 #define PURPLE_SOUND_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_SOUND_THEME, PurpleSoundTheme)) |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
46 #define PURPLE_SOUND_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemeClass)) |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
47 #define PURPLE_IS_SOUND_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_SOUND_THEME)) |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
48 #define PURPLE_IS_SOUND_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_SOUND_THEME)) |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
49 #define PURPLE_SOUND_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemeClass)) |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
50 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
51 struct _PurpleSoundTheme |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
52 { |
23465
d60c3d1c6966
fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23461
diff
changeset
|
53 PurpleTheme parent; |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
54 gpointer priv; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
55 }; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
56 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
57 struct _PurpleSoundThemeClass |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
58 { |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
59 PurpleThemeClass parent_class; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
60 }; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
61 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
62 /**************************************************************************/ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
63 /** @name Purple Sound Theme API */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
64 /**************************************************************************/ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
65 G_BEGIN_DECLS |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
66 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
67 /** |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
68 * GObject foo. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
69 * @internal. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
70 */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
71 GType purple_sound_theme_get_type(void); |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
72 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
73 /** |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
74 * Returns a copy of the filename for the sound event. |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
75 * |
26751
b1c8ffbd48f9
Fix more `make docs` warnings
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
76 * @param theme The theme. |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
77 * @param event The purple sound event to look up. |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
78 * |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
79 * @returns The filename of the sound event. |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
80 */ |
23472
fbf72bbd1084
Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23468
diff
changeset
|
81 const gchar *purple_sound_theme_get_file(PurpleSoundTheme *theme, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
82 const gchar *event); |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
83 |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
84 /** |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
85 * Returns a copy of the directory and filename for the sound event |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
86 * |
26751
b1c8ffbd48f9
Fix more `make docs` warnings
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
87 * @param theme The theme. |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
88 * @param event The purple sound event to look up |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
89 * |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
90 * @returns The directory + '/' + filename of the sound event. This is |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
91 * a newly allocated string that should be freed with g_free. |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
92 */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
93 gchar *purple_sound_theme_get_file_full(PurpleSoundTheme *theme, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
94 const gchar *event); |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
95 |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
96 /** |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
97 * Sets the filename for a given sound event |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
98 * |
26751
b1c8ffbd48f9
Fix more `make docs` warnings
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
99 * @param theme The theme. |
b1c8ffbd48f9
Fix more `make docs` warnings
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
100 * @param event the purple sound event to look up |
b1c8ffbd48f9
Fix more `make docs` warnings
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
101 * @param filename the name of the file to be used for the event |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
102 */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
103 void purple_sound_theme_set_file(PurpleSoundTheme *theme, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
104 const gchar *event, |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
105 const gchar *filename); |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
106 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
107 G_END_DECLS |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
23472
diff
changeset
|
108 #endif /* PURPLE_SOUND_THEME_H */ |