Hi,

attached is a patch for licq_message.h that fixes a bug which made licq crash when it's restarted while there's an unread receive-contacts event. the error was due to the copy function of CEventContactList which copies the CContact entries by strdupping the m_szID field (while the history doesn't initialize this field). the patch initalizes m_szID when CContact is created with a numberic id by asprintfing it.

Regards
Joachim
--- licq_message.h	2006-03-25 05:51:13.000000000 +0100
+++ licq_message.h	2006-05-18 22:06:42.000000000 +0200
@@ -394,9 +394,9 @@
 {
 public:
   CContact(const char *s, unsigned long n, const char *a)
-    {  m_szId = strdup(s); m_nPPID = n; m_szAlias = strdup(a); m_nUin = 0; }
+    {  m_szId = strdup(s); m_nPPID = n; m_szAlias = strdup(a); m_nUin = strtoul(s, (char**)NULL, 10); }
   CContact(unsigned long n, const char *a)
-    { m_szId = 0; m_nPPID = 0; m_nUin = n; m_szAlias = strdup(a); }
+    { asprintf(&m_szId, "%lu", n); m_nPPID = 0; m_nUin = n; m_szAlias = strdup(a); }
   ~CContact() { free(m_szAlias); free(m_szId); }
 
   unsigned long Uin() { return m_nUin; }

Reply via email to