1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 20:26:39 +02:00

Fix odd crash bug in the inspircd* modules by replacing use of myStrGetToken with spacesepstraem, also fix a problem on Windows with not having FD_ZERO in the sgets() function before FD_SET is called, both spotted thanks to Brandan.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2126 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
cyberbotx
2009-02-23 00:58:46 +00:00
parent 9123489c32
commit 419b4c8002
3 changed files with 13 additions and 14 deletions
+6 -7
View File
@@ -15,6 +15,7 @@
#include "services.h"
#include "pseudo.h"
#include "hashcomp.h"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
@@ -775,9 +776,6 @@ int anope_event_fjoin(const char *source, int ac, const char **av)
{
const char *newav[10];
/* value used for myStrGetToken */
int curtoken = 0;
/* storing the current nick */
char *curnick;
@@ -794,8 +792,11 @@ int anope_event_fjoin(const char *source, int ac, const char **av)
if (ac < 3)
return MOD_CONT;
curnick = myStrGetToken(av[2], ' ', curtoken);
while (curnick != NULL) {
spacesepstream nicks(av[2]);
std::string nick;
while (nicks.GetToken(nick)) {
curnick = sstrdup(nick.c_str());
char *curnick_real = curnick;
for (; *curnick; curnick++) {
/* I bet theres a better way to do this... */
@@ -818,8 +819,6 @@ int anope_event_fjoin(const char *source, int ac, const char **av)
strncat(nicklist, prefixandnick, 513);
strncat(nicklist, " ", 513);
delete [] curnick_real;
curtoken++;
curnick = myStrGetToken(av[2], ' ', curtoken);
nlen = 0;
}
+6 -7
View File
@@ -15,6 +15,7 @@
#include "services.h"
#include "pseudo.h"
#include "hashcomp.h"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
@@ -828,9 +829,6 @@ int anope_event_fjoin(const char *source, int ac, const char **av)
{
const char *newav[30]; // hopefully 30 will do until the stupid ac/av stuff goes away.
/* value used for myStrGetToken */
int curtoken = 0;
/* storing the current nick */
char *curnick;
@@ -847,9 +845,12 @@ int anope_event_fjoin(const char *source, int ac, const char **av)
if (ac <= 3)
return MOD_CONT;
curnick = myStrGetToken(av[ac - 1], ' ', curtoken);
while (curnick != NULL)
spacesepstream nicks(av[ac - 1]);
std::string nick;
while (nicks.GetToken(nick))
{
curnick = sstrdup(nick.c_str());
char *curnick_real = curnick;
for (; *curnick; curnick++)
{
@@ -887,8 +888,6 @@ endnick:
strncat(nicklist, prefixandnick, 513);
strncat(nicklist, " ", 513);
delete [] curnick_real;
curtoken++;
curnick = myStrGetToken(av[ac - 1], ' ', curtoken);
nlen = 0;
}
+1
View File
@@ -419,6 +419,7 @@ char *sgets(char *buf, int len, ano_socket_t s)
if (len == 0)
return NULL;
FD_ZERO(&fds);
FD_SET(s, &fds);
tv.tv_sec = ReadTimeout;
tv.tv_usec = 0;