Client_ID(Origin), Req->command);
goto chan_exit;
}
+ if (!Req->argv[arg_arg][0] || strchr(Req->argv[arg_arg], ' ')) {
+ if (is_machine)
+ Log(LOG_ERR,
+ "Got invalid key on MODE +k for \"%s\" from \"%s\"! Ignored.",
+ Channel_Name(Channel), Client_ID(Origin));
+ else
+ connected = IRC_WriteErrClient(Origin,
+ ERR_INVALIDMODEPARAM_MSG,
+ Client_ID(Origin),
+ Channel_Name(Channel), 'k');
+ goto chan_exit;
+ }
if (is_oper || is_machine || is_owner ||
is_admin || is_op || is_halfop) {
Channel_ModeDel(Channel, 'k');
Client_ID(Origin), Req->command);
goto chan_exit;
}
+ l = atol(Req->argv[arg_arg]);
+ if (l <= 0 || l >= 0xFFFF) {
+ if (is_machine)
+ Log(LOG_ERR,
+ "Got MODE +l with invalid limit for \"%s\" from \"%s\"! Ignored.",
+ Channel_Name(Channel), Client_ID(Origin));
+ else
+ connected = IRC_WriteErrClient(Origin,
+ ERR_INVALIDMODEPARAM_MSG,
+ Client_ID(Origin),
+ Channel_Name(Channel), 'l');
+ goto chan_exit;
+ }
if (is_oper || is_machine || is_owner ||
is_admin || is_op || is_halfop) {
- l = atol(Req->argv[arg_arg]);
- if (l > 0 && l < 0xFFFF) {
- Channel_ModeDel(Channel, 'l');
- Channel_SetMaxUsers(Channel, l);
- snprintf(argadd, sizeof(argadd), "%ld", l);
- x[0] = *mode_ptr;
- }
+ Channel_ModeDel(Channel, 'l');
+ Channel_SetMaxUsers(Channel, l);
+ snprintf(argadd, sizeof(argadd), "%ld", l);
+ x[0] = *mode_ptr;
} else {
connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2020 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2023 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define ERR_USERNOTONSERV_MSG "504 %s %s :User is not on this server"
#define ERR_NOINVITE_MSG "518 %s :Cannot invite to %s (+V)"
+#define ERR_INVALIDMODEPARAM_MSG "696 %s %s %c * :Invalid mode parameter"
+
#ifdef ZLIB
# define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld"
#endif