Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dircproxy crash on nick change to NICK_AWAY because of away if NICK_AWAY is already taken #75

Open
GoogleCodeExporter opened this issue Nov 10, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Bug as seen with gdb:
Scenario: IRC Client leaves, dircproxy should remain connected to #obscurechan
Dircproxy attempts a nick change to obscurenick_afk (as configured) but 
obscurenick_afk is already taken. Therefore, IRC server refuses the change

######################### Output of GDB #####################
>> 'QUIT :Leaving'
c=3d, s=1f
<- 'ERROR :Closing Link: obscurenick[~obscurenick@host.example.com] (Detached 
from dircproxy 1.2.0)'
Detaching proxy
User log file = '/home/dircproxy/log//Server.log'
User log file = '/home/dircproxy/log//#obscurechan.log'
-> 'AWAY :Not reading now, messages are logged'
Auto-nick-change 'obscurenick_afk'
Requesting nick change from 'obscurenick' to 'obscurenick_afk'
-> 'NICK :obscurenick_afk'
Server will change it for us
<< ':ircserver.net 306 obscurenick :You have been marked as being away'
<< ':ircserver.net 433 obscurenick obscurenick_afk :Nickname is already in use.'
nickname WAS 'obscurenick'
nickname NOW 'obscurenick'

Program received signal SIGSEGV, Segmentation fault.
0xb7ed716a in strcmp () from /lib/libc.so.6
(gdb) backtrace
#0  0xb7ed716a in strcmp () from /lib/libc.so.6
#1  0x0804eb18 in ircclient_checknickname (p=0x80741a0) at irc_client.c:993
#2  0x08054564 in _ircserver_gotmsg (p=0x80741a0, str=0x8076490 ":ircserver.net 
433 obscurenick obscurenick_afk :Nickname is already in use.")
    at irc_server.c:682
#3  0x08053855 in _ircserver_data (p=0x80741a0, sock=9) at irc_server.c:441
#4  0x08064b1c in net_poll () at net.c:920
#5  0x0804a507 in main (argc=3, argv=0xbffff4a4) at main.c:324
(gdb) frame 1
#1  0x0804eb18 in ircclient_checknickname (p=0x80741a0) at irc_client.c:993
993   if (p->conn_class && p->conn_class->nick_keep
(gdb) frame 0
#0  0xb7ed716a in strcmp () from /lib/libc.so.6
(gdb) frame 1
#1  0x0804eb18 in ircclient_checknickname (p=0x80741a0) at irc_client.c:993
993   if (p->conn_class && p->conn_class->nick_keep
(gdb) print p
$1 = (struct ircproxy *) 0x80741a0
(gdb) print p->nickname
$2 = 0x80731b0 "obscurenick"
(gdb) print p->setnickname
$3 = 0x0
(gdb) quit

What is the expected output? What do you see instead?
I expect no segfault and dircproxy should not change the nickname or change to 
another (generated) nickname.

What version of the product are you using? On what operating system?
dircproxy 1.2.0

Proposed Patch:

--- dircproxy-1.2.0-RC1/src/irc_client.c    2009-01-15 20:27:28.000000000 +0000
+++ dircproxy-1.2.0-RC1_nosetnick/src/irc_client.c  2010-11-01 
13:37:48.000000000 +0000
@@ -990,11 +990,11 @@

 /* Check whether we need to restore the nickname later */
 int ircclient_checknickname(struct ircproxy *p) {
-  if (p->conn_class && p->conn_class->nick_keep
-      && strcmp(p->nickname, p->setnickname))
+  if (p->conn_class && p->conn_class->nick_keep && p->setnickname) {
+    if (strcmp(p->nickname, p->setnickname))
     timer_new((void *)p, "client_resetnick", NICK_GUARD_TIME,
               TIMER_FUNCTION(_ircclient_resetnick), (void *)0);
-
+  }
   return 0;
 }


Original issue reported on code.google.com by hueffelm...@googlemail.com on 3 Nov 2010 at 10:40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant