#include "portab.h"
-static char UNUSED id[] = "$Id: conf.c,v 1.94 2006/11/05 13:03:48 fw Exp $";
+static char UNUSED id[] = "$Id: conf.c,v 1.96 2006/11/20 19:32:07 fw Exp $";
#include "imp.h"
#include <assert.h>
} /* Handle_SERVER */
+static bool
+Handle_Channelname(size_t chancount, const char *name)
+{
+ size_t size = sizeof( Conf_Channel[chancount].name );
+ char *dest = Conf_Channel[chancount].name;
+
+ if (*name && *name != '#') {
+ *dest = '#';
+ --size;
+ ++dest;
+ }
+ return size > strlcpy(dest, name, size);
+}
+
+
static void
Handle_CHANNEL( int Line, char *Var, char *Arg )
{
chancount = Conf_Channel_Count - 1;
if( strcasecmp( Var, "Name" ) == 0 ) {
- /* Name of the channel */
- len = strlcpy( Conf_Channel[chancount].name, Arg, sizeof( Conf_Channel[chancount].name ));
- if (len >= sizeof( Conf_Channel[chancount].name ))
+ if (!Handle_Channelname(chancount, Arg))
Config_Error_TooLong( Line, Var );
return;
}
do {
if (*ptr >= 'a' && *ptr <= 'z') continue;
if (*ptr >= 'A' && *ptr <= 'Z') continue;
- if (*ptr >= '1' && *ptr <= '0') continue;
+ if (*ptr >= '0' && *ptr <= '9') continue;
if (ptr > Conf_ServerName) {
if (*ptr == '.' || *ptr == '-')
continue;