pidgin: 6f34c0b3: log_reader: Properly fix the QIP crash, ...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Thu Jul 21 02:17:33 EDT 2011
----------------------------------------------------------------------
Revision: 6f34c0b3475fe7d9608714c58bce5b3c93b86804
Parent: 607c3bd71b86e1894add7c6d9e9c1e3898d5b1b3
Author: darkrain42 at pidgin.im
Date: 07/21/11 02:10:54
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6f34c0b3475fe7d9608714c58bce5b3c93b86804
Changelog:
log_reader: Properly fix the QIP crash, and unbreak the Trillian reader (c is NULL the last time through, so just quit out early then)
Woah, are my eyes bleary from staring at this code.
Changes against parent 607c3bd71b86e1894add7c6d9e9c1e3898d5b1b3
patched libpurple/plugins/log_reader.c
-------------- next part --------------
============================================================
--- libpurple/plugins/log_reader.c 2228afca79fe61c04226512ef9154a170eba94f7
+++ libpurple/plugins/log_reader.c 1602ce008ed5b6d27c121e6ffc6c06193273cbbd
@@ -1454,8 +1454,13 @@ static char * trillian_logger_read (Purp
const char *footer = NULL;
GString *temp = NULL;
- /* The data is always terminated with a newline (see above) */
+ /* There's always a trailing '\n' at the end of the file (see above), so
+ * just quit out if we don't find another, because we're at the end.
+ */
c = strchr(c, '\n');
+ if (!c)
+ break;
+
*c = '\0';
c++;
@@ -1818,7 +1823,7 @@ static GList *qip_logger_list(PurpleLogT
gboolean add_new_log = FALSE;
- if (*c) {
+ if (c && *c) {
if (purple_str_has_prefix(c, QIP_LOG_IN_MESSAGE) ||
purple_str_has_prefix(c, QIP_LOG_OUT_MESSAGE)) {
@@ -1903,8 +1908,8 @@ static GList *qip_logger_list(PurpleLogT
if (c && *c) {
/* find EOF */
- c = strchr(c, '\n');
- c++;
+ if ((c = strchr(c, '\n')))
+ c++;
}
}
More information about the Commits
mailing list