| From: Thomas Reitelbach <[EMAIL PROTECTED]>

| On Thursday 30 December 2004 01:25, D. Hugh Redelmeier wrote:

| > It isn't clear how to migrate an old .licq to 1.30.  Certainly, a pure
| > copy does not work (hard to copy a FIFO).  Also, the plugin names are
| > in a configuration file, and they've changed.
| 
| Hm, no, they did not change. Licq does update the configuration files 
| automatically when it detects old config-files. 

My user showed up.  licq crashed (segv) when using his old configs.

Bottom line: there is a bug in 1.30's user.cpp that causes a crash in
line 625 (routine CUserManager::Load).  This code deals with lines in
~/.licq/users.conf.  It wants to split the user number from the
protocol ID:

    sz = strrchr(szFile, '.');
    strncpy(szId, szFile, sz - szFile);
    szId[sz - szFile] = '\0';
    nPPID = (*(sz+1)) << 24 | (*(sz+2)) << 16 | (*(sz+3)) << 8 | (*(sz+4));

Now: think what happens if there is no '.' in the line.  sz will be
NULL.  The strncmp will be passed an invalid length.
szId[somethingawful] will be set to NUL.

My user's user.conf lines had no '.'.  Boom.

For now, we just added .Licq to each line.

Another potential bug: what if there are not 3 characters after the .
AND the line is really long.  The code for calculating nPPID may reach
past the end of szFile.

================

I had quite a lot of trouble debugging this.  I've never used gdb on
c++ code before.  I could not get it to examine local variables.  I
did rebuild all of licq after doing:
        ./configure --enable-debug

This helped: gdb then did know the line numbers for crashes.  Anybody
know how to display, for example, sz or szId when at a breakpoint in
the above code?  "print sz" failed because gdb claimed no to know the
variable (but "print i" worked).  I wonder if the -O2 flag caused
variable info to be washed away.



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
LICQ-Main mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/licq-main

Reply via email to