From f6efbc884282dd0fae1f72fc0c0f282832d45f4e Mon Sep 17 00:00:00 2001 From: Paolo Pisati Date: Mon, 17 Mar 2008 22:08:31 +0000 Subject: [PATCH] Don't abuse stack space while in kernel land, use heap instead. --- sys/netinet/libalias/alias_irc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/netinet/libalias/alias_irc.c b/sys/netinet/libalias/alias_irc.c index ae8ce2a3dec5..98f82ad41a95 100644 --- a/sys/netinet/libalias/alias_irc.c +++ b/sys/netinet/libalias/alias_irc.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #endif @@ -80,6 +81,8 @@ __FBSDID("$FreeBSD$"); #define IRC_CONTROL_PORT_NUMBER_1 6667 #define IRC_CONTROL_PORT_NUMBER_2 6668 +char *newpacket; + /* Local defines */ #define DBprintf(a) @@ -103,8 +106,12 @@ fingerprint(struct libalias *la, struct ip *pip, struct alias_data *ah) static int protohandler(struct libalias *la, struct ip *pip, struct alias_data *ah) { - - AliasHandleIrcOut(la, pip, ah->lnk, ah->maxpktsize); + + newpacket = malloc(IP_MAXPACKET); + if (newpacket) { + AliasHandleIrcOut(la, pip, ah->lnk, ah->maxpktsize); + free(newpacket); + } return (0); } @@ -196,9 +203,7 @@ AliasHandleIrcOut(struct libalias *la, /* Handle CTCP commands - the buffer may have to be copied */ lFOUND_CTCP: { - char newpacket[65536]; /* Estimate of maximum packet size - * :) */ - unsigned int copyat = i; /* Same */ + unsigned int copyat = i; unsigned int iCopy = 0; /* How much data have we written to * copy-back string? */ unsigned long org_addr; /* Original IP address */