|
|
@@ -160,12 +160,12 @@ static int FindElement(char *resultBuf, const char *list, size_t listLength,
|
|
|
if (p == limit) {
|
|
|
if (openBraces != 0) {
|
|
|
if (resultBuf) {
|
|
|
- simple_sprintf(resultBuf, "unmatched open brace in list");
|
|
|
+ simple_snprintf(resultBuf, RESULT_LEN, "unmatched open brace in list");
|
|
|
}
|
|
|
return ERROR;
|
|
|
} else if (inQuotes) {
|
|
|
if (resultBuf) {
|
|
|
- simple_sprintf(resultBuf, "unmatched open quote in list");
|
|
|
+ simple_snprintf(resultBuf, RESULT_LEN, "unmatched open quote in list");
|
|
|
}
|
|
|
return ERROR;
|
|
|
}
|
|
|
@@ -257,7 +257,7 @@ int SplitList(char *resultBuf, const char *list, int *argcPtr, const char ***arg
|
|
|
if (i >= size) {
|
|
|
free((char *) argv);
|
|
|
if (resultBuf)
|
|
|
- simple_sprintf(resultBuf, "internal error in SplitList");
|
|
|
+ simple_snprintf(resultBuf, RESULT_LEN, "internal error in SplitList");
|
|
|
return ERROR;
|
|
|
}
|
|
|
|
|
|
@@ -290,7 +290,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
int old_status = chan->status,
|
|
|
old_mode_mns_prot = chan->mode_mns_prot,
|
|
|
old_mode_pls_prot = chan->mode_pls_prot;
|
|
|
- char s[121] = "";
|
|
|
+ char s[121] = "", result_extra[RESULT_LEN / 2] = "";
|
|
|
|
|
|
for (register int i = 0; i < items; i++) {
|
|
|
/* Chanchar template
|
|
|
@@ -298,7 +298,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel temp needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel temp needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
strlcpy(chan->temp, item[i], sizeof(chan->temp));
|
|
|
@@ -308,7 +308,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel chanmode needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel chanmode needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
strlcpy(s, item[i], 121);
|
|
|
@@ -319,7 +319,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "topic needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "topic needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
p = replace(item[i], "{", "[");
|
|
|
@@ -329,7 +329,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "addedby needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "addedby needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
strlcpy(chan->added_by, item[i], NICKLEN);
|
|
|
@@ -337,7 +337,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "addedts needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "addedts needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->added_ts = atoi(item[i]);
|
|
|
@@ -345,7 +345,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel idle-kick needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel idle-kick needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->idle_kick = atoi(item[i]);
|
|
|
@@ -353,7 +353,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel limit needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel limit needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->limitraise = atoi(item[i]);
|
|
|
@@ -364,7 +364,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel stopnethack-mode needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel stopnethack-mode needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->stopnethack_mode = atoi(item[i]);
|
|
|
@@ -372,7 +372,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel revenge-mode needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel revenge-mode needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->revenge_mode = atoi(item[i]);
|
|
|
@@ -380,7 +380,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel ban-time needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel ban-time needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->ban_time = atoi(item[i]);
|
|
|
@@ -388,7 +388,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel exempt-time needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel exempt-time needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->exempt_time = atoi(item[i]);
|
|
|
@@ -396,7 +396,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel invite-time needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel invite-time needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->invite_time = atoi(item[i]);
|
|
|
@@ -404,7 +404,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel closed-ban needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel closed-ban needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->closed_ban = atoi(item[i]);
|
|
|
@@ -412,7 +412,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel closed-invite needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel closed-invite needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->closed_invite = atoi(item[i]);
|
|
|
@@ -420,7 +420,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel closed-private needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel closed-private needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->closed_private = atoi(item[i]);
|
|
|
@@ -428,7 +428,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel voice-ident needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel voice-ident needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->voice_non_ident = atoi(item[i]);
|
|
|
@@ -436,7 +436,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel bad-cookie needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel bad-cookie needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->bad_cookie = deflag_translate(item[i]);
|
|
|
@@ -444,7 +444,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel manop needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel manop needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->manop = deflag_translate(item[i]);
|
|
|
@@ -452,7 +452,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel mdop needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel mdop needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->mdop = deflag_translate(item[i]);
|
|
|
@@ -460,7 +460,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "channel mop needs argument");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "channel mop needs argument");
|
|
|
return ERROR;
|
|
|
}
|
|
|
chan->mop = deflag_translate(item[i]);
|
|
|
@@ -469,7 +469,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
* i++;
|
|
|
* if (i >= items) {
|
|
|
* if (result)
|
|
|
- * simple_sprintf(result, "channel temp needs argument");
|
|
|
+ * simple_snprintf(result, RESULT_LEN, "channel temp needs argument");
|
|
|
* return ERROR;
|
|
|
* }
|
|
|
* chan->temp = atoi(item[i]);
|
|
|
@@ -626,13 +626,13 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
ptime = &chan->flood_nick_time;
|
|
|
} else {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "illegal channel flood type: %s", item[i]);
|
|
|
+ simple_snprintf(result, RESULT_LEN, "illegal channel flood type: %s", item[i]);
|
|
|
return ERROR;
|
|
|
}
|
|
|
i++;
|
|
|
if (i >= items) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "%s needs argument", item[i - 1]);
|
|
|
+ simple_snprintf(result, RESULT_LEN, "%s needs argument", item[i - 1]);
|
|
|
return ERROR;
|
|
|
}
|
|
|
p = strchr(item[i], ':');
|
|
|
@@ -647,7 +647,8 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
}
|
|
|
} else {
|
|
|
if (result && item[i][0]) /* ignore "" */
|
|
|
- simple_sprintf(result, "illegal channel option: %s", item[i]);
|
|
|
+ simple_snprintf(result, RESULT_LEN, "illegal channel option: ");
|
|
|
+ simple_snprintf(result_extra, sizeof(result_extra), "%s %s", result_extra[0] ? result_extra : "", item[i]);
|
|
|
error = 1;
|
|
|
}
|
|
|
}
|
|
|
@@ -677,6 +678,9 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
|
|
|
recheck_channel_modes(chan);
|
|
|
}
|
|
|
}
|
|
|
+ if (result && result[0] && result_extra[0])
|
|
|
+ strcat(result, result_extra);
|
|
|
+
|
|
|
if (error)
|
|
|
return ERROR;
|
|
|
return OK;
|
|
|
@@ -759,13 +763,13 @@ int channel_add(char *result, char *newname, char *options)
|
|
|
{
|
|
|
if (!newname || !newname[0] || !strchr(CHANMETA, newname[0])) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "invalid channel prefix");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "invalid channel prefix");
|
|
|
return ERROR;
|
|
|
}
|
|
|
|
|
|
if (strchr(newname, ',') != NULL) {
|
|
|
if (result)
|
|
|
- simple_sprintf(result, "invalid channel name");
|
|
|
+ simple_snprintf(result, RESULT_LEN, "invalid channel name");
|
|
|
return ERROR;
|
|
|
}
|
|
|
|