Shoutbox

Bug in plugin support? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Bug in plugin support? (/showthread.php?tid=12580)

Bug in plugin support? by Finn on 07-08-2003 at 07:40 PM

was trying to fix the bug with the colour fade plugin crashing msn plus and it doesnt seem to be related to the colour fade plugin


the following code causes the crash and given the docs should be perfectly fine, this a bug in msn plus ?



if(stricmp(sCommand, "/xcopy") == 0)
{
strncpy(sResult, sCommandArg, 1500);
return TRUE;
}

it crashes if you do /xcopy blahblahblahblah.. (for as many as you can do) and it cant have spaces in the blahblahblah etc


RE: Bug in plugin support? by allex87 on 07-08-2003 at 08:43 PM

maybe because if the message length is longer than 1100 (i think thats maximum), the program will crash...but.. to work around it, just set a strlen if...

size_t len;
len = strlen(sCommandArg);
if (len < 1094)
{
   //do whatever you want
}
else
{
  MessageBox(NULL, "Maximum message length exceeded!", "WARNING!", MB_OK);
}

If u do the math (and i hope i did it correctly.. :P).. considering the message length should not exceed 1100 chars... the /xcopy command has 6 characters +1 space, so 7 (no null). Next, your full message can only be 1001(with null) - 7 = 1094... ;)


RE: Bug in plugin support? by Finn on 07-08-2003 at 09:43 PM

the docs say you can output 2048 though even if only 1100 can be sent


RE: Bug in plugin support? by Patchou on 07-08-2003 at 11:55 PM

Thanks for the bug report but I'm not sure to understand what the problem is. Please pos the code of the whole function that causes Plus! to crash and I'll fix the problem :).

Note: please make sure you upgraded to version 2.20.48 first.
Patchou


RE: Bug in plugin support? by Finn on 07-09-2003 at 07:10 AM

Sorry if i wasnt too clear

the full function :-

MPPLUGIN_RETURN_BOOL ParseCommand(/*[in]*/  const char* sCommand,
                                  /*[in]*/  const char* sCommandArg,
                                  /*[in]*/  PLUGIN_PARAM* pParam,
                                  /*[out]*/ char* sResult)
{
if(stricmp(sCommand, "/xcopy") == 0)
{
strncpy(sResult, sCommandArg, 1500);
return TRUE;
}
return FALSE;
}


now if you open a chat window and do /xcopy blahblahblahblahblahblahblah.. (until you cant type anymore and with no spaces) msn plus will crash

HTH


RE: Bug in plugin support? by Bamboe on 07-09-2003 at 11:55 AM

why don't you do this?

if(stricmp(sCommand, "/xcopy") == 0 && strlen(sCommandArg) < 500 (or whatever the maximum is))


RE: Bug in plugin support? by Whacko on 07-09-2003 at 12:09 PM

The xfade plugin is probably causing this.... as it uses 2 characters before each letter to change the letter's color so each letter takes 3 places. resulting in 3300 characters outputed by the plugin, if the text you typed was 1100. which Messenger wont like very much :P


RE: Bug in plugin support? by Finn on 07-09-2003 at 05:24 PM

err no, its got nothing to do with that, msn plus doesnt seem to like getting a large chunk of characters without spaces placed in sResult, i tried with as few as 500 characters and it still crashed