summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Atallah <datallah@pidgin.im>2009-05-02 19:33:22 +0000
committerDaniel Atallah <datallah@pidgin.im>2009-05-02 19:33:22 +0000
commit626569cb9e48ab31c93997d14dbb8d6312e33f14 (patch)
tree6bc4c2fe1fb067c0904f578d7bd2681e89c2f8e3
parent1651bc33d3da082ec6e4b1323f5b20991327fe47 (diff)
downloadpidgin-626569cb9e48ab31c93997d14dbb8d6312e33f14.tar.gz
Prevent a NUL ptr deref when the passport is malformed.
This came out of the veracode analysis.
-rw-r--r--libpurple/protocols/msn/oim.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c
index 927c9376aa..1aebaadda8 100644
--- a/libpurple/protocols/msn/oim.c
+++ b/libpurple/protocols/msn/oim.c
@@ -668,9 +668,15 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str)
if (tokens[1] != NULL)
from = (const char *)tokens[1];
- start = strchr(from, '<') + 1;
- end = strchr(from, '>');
- passport = g_strndup(start, end - start);
+ start = strchr(from, '<');
+ if (start != NULL) {
+ start++;
+ end = strchr(from, '>');
+ if (end != NULL)
+ passport = g_strndup(start, end - start);
+ }
+ if (passport == NULL)
+ passport = g_strdup(_("Unknown"));
g_strfreev(tokens);
}