Perhaps this is fine on i386 version and not amd64. 

I had the following backtrace on amd64:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2b2488ece270 (LWP 10505)]
0x00002b248748f4f0 in strcmp () from /lib/libc.so.6
(gdb) backtrace
#0  0x00002b248748f4f0 in strcmp () from /lib/libc.so.6
#1  0x0000000000671ee4 in _yahoo_assign_server_settings (ap=0x7fff26115a00)
    at libyahoo2.c:296
#2  0x000000000067b097 in yahoo_init_with_attributes (
    username=0xb47c88 "****", password=0xb48188 "****") at libyahoo2.c:3408
#3  0x000000000052e262 in yahoohook::connect (this=0x98a100) 
    at yahoohook.cc:148
#4  0x000000000052c40d in yahoohook::setautostatus (this=0x98a100,
    st=available) at yahoohook.cc:455
#5  0x0000000000514df2 in abstracthook::setstatus (this=0x98a100,
    st=available) at abstracthook.cc:75
#6  0x0000000000412d51 in centerim::changestatus (this=0x9876e0) 
    at centerim.cc:476
#7  0x00000000004132c1 in centerim::mainloop (this=0x9876e0) 
    at centerim.cc:191
#8  0x0000000000415bf6 in centerim::exec (this=0x9876e0) 
    at centerim.cc:106
#9  0x00000000004b1f84 in main (argc=3, argv=0x7fff261172c8) 
    at centermain.cc:61
(gdb) 

The check on "key" variable is for NULL to indicate the end of the
va_list as passed a few calls back.  It seems the NULL isn't coming through
as a NULL.  According to the man page:

If  there  is  no  next argument, or if type is not compatible with the
type of the actual next argument (as promoted according to the
default argument promotions), random errors will occur.


On line 3416 of libyahoo2/libyahoo.c file

return yahoo_init_with_attributes(username, password, NULL);

Probably this NULL doesn't come through as an expected char * type in
_yahoo_assign_server_settings function. I believe that when NULL is
passed it is thought of as an int but we want a char * in later calls.
This would explain an amd64 error and not a i386 one if such was the
case. Also, this error was never there before but is now. I think this
might be becuase GCC is now version 4.2.2 whereas previously compiled
versions of centerim was with 4.2.1. (So va_arg handling has changed in
the newer gcc 4.2.2?)


To fix I simply replace that line

return yahoo_init_with_attributes(username, password, (char *) NULL);



Similarly in the file src/hooks/yahoohook.cc on line 146

    cid = yahoo_init_with_attributes(acc.nickname.c_str(),
acc.password.c_str(),
        "pager_host", acc.server.c_str(),
        "pager_port", acc.port, NULL);

Should be

    cid = yahoo_init_with_attributes(acc.nickname.c_str(),
acc.password.c_str(),
        "pager_host", acc.server.c_str(),
        "pager_port", acc.port, (char *) NULL);


I've attached patches.

It all built fine here and works without crashes for me now.

A good Friday night spent at the computer. :)

Also perhaps this needs to be changed in the libyahoo2 sources also (and
upstream? if that could be forwarded on)


Thanks

Chris Donoghue


diff -Naur centerim-4.22.1.old/libyahoo2/libyahoo2.c centerim-4.22.1/libyahoo2/libyahoo2.c
--- centerim-4.22.1.old/libyahoo2/libyahoo2.c	2007-10-04 07:42:12.000000000 +1000
+++ centerim-4.22.1/libyahoo2/libyahoo2.c	2007-10-26 21:20:52.832436381 +1000
@@ -3413,7 +3413,7 @@
 
 int yahoo_init(const char *username, const char *password)
 {
-	return yahoo_init_with_attributes(username, password, NULL);
+	return yahoo_init_with_attributes(username, password, (char *) NULL);
 }
 
 struct connect_callback_data {
diff -Naur centerim-4.22.1.old/src/hooks/yahoohook.cc centerim-4.22.1/src/hooks/yahoohook.cc
--- centerim-4.22.1.old/src/hooks/yahoohook.cc	2007-10-04 07:42:12.000000000 +1000
+++ centerim-4.22.1/src/hooks/yahoohook.cc	2007-10-26 21:20:31.588836054 +1000
@@ -145,7 +145,7 @@
 
     cid = yahoo_init_with_attributes(acc.nickname.c_str(), acc.password.c_str(),
 	"pager_host", acc.server.c_str(),
-	"pager_port", acc.port, 0);
+	"pager_port", acc.port, (char *) NULL);
 
     yahoo_login(cid, stat2int[manualstatus]);
 

Reply via email to