$ grep "MAX_STRING_LENGTH " *
genmob.c: ldesc[MAX_STRING_LENGTH - 1] = '\0';
genmob.c: ddesc[MAX_STRING_LENGTH - 1] = '\0';
genmob.c: strip_cr(strncpy(ldesc, GET_LDESC(mob), MAX_STRING_LENGTH - 1));
genmob.c: strip_cr(strncpy(ddesc, GET_DDESC(mob), MAX_STRING_LENGTH - 1));
genolc.c: ldesc[MAX_STRING_LENGTH - 1] = '\0';
genolc.c: ddesc[MAX_STRING_LENGTH - 1] = '\0';
genolc.c: strip_cr(strncpy(ldesc, GET_LDESC(mob), MAX_STRING_LENGTH - 1));
genolc.c: strip_cr(strncpy(ddesc, GET_DDESC(mob), MAX_STRING_LENGTH - 1));
modify.c: if (diff > MAX_STRING_LENGTH - 3) /* 3=\r\n\0 */
modify.c: diff = MAX_STRING_LENGTH - 3;
objsave.c: char buf1[MAX_STRING_LENGTH +1];
structs.h:#define MAX_STRING_LENGTH 49152 /**< Max length of string, as defined */
structs.h:#define MAX_HELP_ENTRY MAX_STRING_LENGTH /**< Max size of help entry */
utils.c: while((rp - ret) < MAX_STRING_LENGTH && (*sp1 || *sp2)) {
utils.c: while((rp - ret) < MAX_STRING_LENGTH && *sp1 && !ISNEWL(*sp1))
utils.c: while((rp - ret) < MAX_STRING_LENGTH && *sp2 && !ISNEWL(*sp2))
argall[0] = '\0';
while ( argument[0] != '\0' )
{
argument = one_argument( argument, argone );
if ( argall[0] != '\0' )
strcat( argall, " " );
strcat( argall, argone );
}
argall[0] = '\0';
while ( argument[0] != '\0' )
{
argument = one_argument( argument, argone );
if ( argall[0] != '\0' )
strcat( argall, " " );
strcat( argall, argone );
}
Today's "WTF" moment, comes from merc.h. You've all used our beloved MAX_STRING_LENGTH define, and I'm sure like myself, you never really bothered to look at what it was defined as. I mean, MAX_INPUT_LENGTH is 256, so some reasonable value like 1024, 2048, 4096, etc… right?
#define MAX_STRING_LENGTH 4608
W.T.F???
Where the hell does THAT number come from? I actually sat and tried to think of why they'd pick it. 4096 + 512 == 4608, but why the extra 512 overhead? Why not just make it 4096… or 8192 if that's not big enough? 4608 / 4 == 1152. Maybe they used a screen resolution of 1152 x 864???
Ok, well… eventually it won't matter, but for now I cared because the C++ format routine I have uses a pre-allocated stack buffer of a "usually works" size to avoid having to allocate memory for vsnprintf. I wanted to look up what value to put in there. :)