comparison libpurple/protocols/bonjour/jabber.c @ 24674:7b10acb20526

Fix CID 399 - I'm reasonably sure this couldn't ever actually cause a NULL deref.
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 10 Dec 2008 02:28:30 +0000
parents 5706043db5b5
children 35d0ce5f319a
comparison
equal deleted inserted replaced
24673:5706043db5b5 24674:7b10acb20526
126 /* we just want the stuff inside <font></font> 126 /* we just want the stuff inside <font></font>
127 * There isn't stuff exposed in xmlnode.c to do this more cleanly. */ 127 * There isn't stuff exposed in xmlnode.c to do this more cleanly. */
128 128
129 if (contents) { 129 if (contents) {
130 char *bodystart = strchr(contents, '>'); 130 char *bodystart = strchr(contents, '>');
131 char *bodyend = strrchr(bodystart, '<'); 131 char *bodyend = bodystart ? strrchr(bodystart, '<') : NULL;
132 if (bodystart && bodyend && (bodystart + 1) != bodyend) { 132 if (bodystart && bodyend && (bodystart + 1) != bodyend) {
133 *bodyend = '\0'; 133 *bodyend = '\0';
134 memmove(contents, bodystart + 1, (bodyend - bodystart)); 134 memmove(contents, bodystart + 1, (bodyend - bodystart));
135 } 135 }
136 } 136 }