Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: help debuging my module in progress  (Read 4070 times)

0 Members and 1 Guest are viewing this topic.

MrStonedone

  • Anope User
  • Offline Offline
  • Posts: 17
help debuging my module in progress
« on: May 28, 2010, 10:24:53 PM »

basic info about module: provides a link between site and irc, making sure accounts on each side are link up, since the site is private we don't want non-site-users from having nickserv accounts (well, really its a lazy way of making a site-user only channel, now +R == site-users only as well)

http://pastebin.anope.org/index.php?page=viewpaste&id=503f67a366

this is a wrapper part of the script, attaches to modhead and modtail of ns register and does some checks then messes with strtok so nickserv's core reg function doesn't see the irckey given and think its a email.

I had 3 random crashes since coding this part, and they all point to the free()ing of the new buffer i made for strtok and nickserv. the latest one it was when checkbuf was called in reg_tail.

back trace: http://pastebin.anope.org/index.php?page=viewpaste&id=9e840fafd2

module name is ns_sitelink
Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 463
Re: help debuging my module in progress
« Reply #1 on: May 28, 2010, 10:38:41 PM »

In sl_reg_head you're going to want to free(password). Also, you want strlen(passkey) not sizeof(passkey). Even if you did that, you are still adding password to s1_newbuf  not passkey.. which is what you attempted to allocate enough memory for. You need to malloc an additional four bytes not three, because of the trailing \0.

In sl_reg_tail you need to free(passkey).
Logged

MrStonedone

  • Anope User
  • Offline Offline
  • Posts: 17
Re: help debuging my module in progress
« Reply #2 on: May 28, 2010, 10:49:19 PM »

grr i thought i fixed all of the sizeof's(protip: don't code while sleepy =\) and thanks for pointing out the passkey/password mishap.
As for malloc im adding 1:space: then password, so shouldn't +3 be enough since im adding two letters to it? i still changed it to +4
Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 463
Re: help debuging my module in progress
« Reply #3 on: May 28, 2010, 10:52:11 PM »

You're adding "1 " then the password then " \0", which is 4.
Logged
Pages: [1]   Go Up