Secured sprintf with snprintf
This commit is contained in:
parent
07d2480f7e
commit
94f92ab25b
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Sysop to user chat utility
|
* Purpose ...............: Sysop to user chat utility
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2004
|
* Copyright (C) 1997-2005
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
int chat_with_sysop = FALSE; /* Global sysop chat flag */
|
int chat_with_sysop = FALSE; /* Global sysop chat flag */
|
||||||
int chatting = FALSE; /* Global chatting flag */
|
int chatting = FALSE; /* Global chatting flag */
|
||||||
char rbuf[50][80]; /* Chat receive buffer */ /* FIXME: must be a dynamic buffer */
|
char rbuf[50][81]; /* Chat receive buffer */ /* FIXME: must be a dynamic buffer */
|
||||||
int rpointer = 0; /* Chat receive pointer */
|
int rpointer = 0; /* Chat receive pointer */
|
||||||
int rsize = 5; /* Chat receive size */
|
int rsize = 5; /* Chat receive size */
|
||||||
extern pid_t mypid;
|
extern pid_t mypid;
|
||||||
@ -123,7 +123,7 @@ void DispMsg(char *msg)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
strncpy(rbuf[rpointer], msg, 80);
|
strncpy(rbuf[rpointer], msg, 81);
|
||||||
Showline(2 + rpointer, 1, rbuf[rpointer]);
|
Showline(2 + rpointer, 1, rbuf[rpointer]);
|
||||||
if (rpointer == rsize) {
|
if (rpointer == rsize) {
|
||||||
/*
|
/*
|
||||||
@ -132,7 +132,7 @@ void DispMsg(char *msg)
|
|||||||
for (i = 0; i <= rsize; i++) {
|
for (i = 0; i <= rsize; i++) {
|
||||||
locate(i + 2, 1);
|
locate(i + 2, 1);
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
sprintf(rbuf[i], "%s", rbuf[i+1]);
|
snprintf(rbuf[i], 81, "%s", rbuf[i+1]);
|
||||||
Showline(i + 2, 1, rbuf[i]);
|
Showline(i + 2, 1, rbuf[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -194,10 +194,10 @@ void Chat(char *username, char *channel)
|
|||||||
locate(1, 1);
|
locate(1, 1);
|
||||||
colour(WHITE, BLUE);
|
colour(WHITE, BLUE);
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
sprintf(buf, "%-*s", 79, " MBSE BBS Chat Server");
|
snprintf(buf, 200, "%-*s", 79, " MBSE BBS Chat Server");
|
||||||
mvprintw(1, 1, buf);
|
mvprintw(1, 1, buf);
|
||||||
|
|
||||||
sprintf(buf, "CCON,4,%d,%s,%s,0;", mypid, exitinfo.sUserName, exitinfo.Name);
|
snprintf(buf, 200, "CCON,4,%d,%s,%s,0;", mypid, exitinfo.sUserName, exitinfo.Name);
|
||||||
Syslog('c', "> %s", buf);
|
Syslog('c', "> %s", buf);
|
||||||
if (socket_send(buf) == 0) {
|
if (socket_send(buf) == 0) {
|
||||||
strncpy(buf, socket_receive(), sizeof(buf)-1);
|
strncpy(buf, socket_receive(), sizeof(buf)-1);
|
||||||
@ -218,7 +218,7 @@ void Chat(char *username, char *channel)
|
|||||||
locate(exitinfo.iScreenLen - 2, 1);
|
locate(exitinfo.iScreenLen - 2, 1);
|
||||||
colour(WHITE, BLUE);
|
colour(WHITE, BLUE);
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
sprintf(buf, "%-*s", 79, " Chat, type \"/EXIT\" to exit or \"/HELP\" for help");
|
snprintf(buf, 200, "%-*s", 79, " Chat, type \"/EXIT\" to exit or \"/HELP\" for help");
|
||||||
mvprintw(exitinfo.iScreenLen - 2, 1, buf);
|
mvprintw(exitinfo.iScreenLen - 2, 1, buf);
|
||||||
|
|
||||||
colour(LIGHTGRAY, BLACK);
|
colour(LIGHTGRAY, BLACK);
|
||||||
@ -231,10 +231,10 @@ void Chat(char *username, char *channel)
|
|||||||
* commands to the chatserver.
|
* commands to the chatserver.
|
||||||
*/
|
*/
|
||||||
if (username && channel) {
|
if (username && channel) {
|
||||||
sprintf(buf, "CPUT:2,%d,/nick %s;", mypid, username);
|
snprintf(buf, 200, "CPUT:2,%d,/nick %s;", mypid, username);
|
||||||
if (socket_send(buf) == 0)
|
if (socket_send(buf) == 0)
|
||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
sprintf(buf, "CPUT:2,%d,/join %s;", mypid, channel);
|
snprintf(buf, 200, "CPUT:2,%d,/join %s;", mypid, channel);
|
||||||
if (socket_send(buf) == 0)
|
if (socket_send(buf) == 0)
|
||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
}
|
}
|
||||||
@ -249,7 +249,7 @@ void Chat(char *username, char *channel)
|
|||||||
*/
|
*/
|
||||||
data = TRUE;
|
data = TRUE;
|
||||||
while (data) {
|
while (data) {
|
||||||
sprintf(buf, "CGET:1,%d;", mypid);
|
snprintf(buf, 200, "CGET:1,%d;", mypid);
|
||||||
if (socket_send(buf) == 0) {
|
if (socket_send(buf) == 0) {
|
||||||
strncpy(buf, socket_receive(), sizeof(buf)-1);
|
strncpy(buf, socket_receive(), sizeof(buf)-1);
|
||||||
if (strncmp(buf, "100:2,", 6) == 0) {
|
if (strncmp(buf, "100:2,", 6) == 0) {
|
||||||
@ -303,7 +303,7 @@ void Chat(char *username, char *channel)
|
|||||||
}
|
}
|
||||||
} else if ((ch == '\r') && curpos) {
|
} else if ((ch == '\r') && curpos) {
|
||||||
alarm_on();
|
alarm_on();
|
||||||
sprintf(buf, "CPUT:2,%d,%s;", mypid, sbuf);
|
snprintf(buf, 200, "CPUT:2,%d,%s;", mypid, sbuf);
|
||||||
Syslog('c', "> %s", buf);
|
Syslog('c', "> %s", buf);
|
||||||
if (socket_send(buf) == 0) {
|
if (socket_send(buf) == 0) {
|
||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
@ -336,7 +336,7 @@ void Chat(char *username, char *channel)
|
|||||||
*/
|
*/
|
||||||
data = TRUE;
|
data = TRUE;
|
||||||
while (data) {
|
while (data) {
|
||||||
sprintf(buf, "CGET:1,%d;", mypid);
|
snprintf(buf, 200, "CGET:1,%d;", mypid);
|
||||||
if (socket_send(buf) == 0) {
|
if (socket_send(buf) == 0) {
|
||||||
strncpy(buf, socket_receive(), sizeof(buf)-1);
|
strncpy(buf, socket_receive(), sizeof(buf)-1);
|
||||||
if (strncmp(buf, "100:2,", 6) == 0) {
|
if (strncmp(buf, "100:2,", 6) == 0) {
|
||||||
@ -366,7 +366,7 @@ void Chat(char *username, char *channel)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* *** Sysop has terminated chat *** */
|
/* *** Sysop has terminated chat *** */
|
||||||
sprintf(buf, "%s", (char *) Language(60));
|
snprintf(buf, 200, "%s", (char *) Language(60));
|
||||||
DispMsg(buf);
|
DispMsg(buf);
|
||||||
Syslog('+', "Sysop chat ended");
|
Syslog('+', "Sysop chat ended");
|
||||||
chat_with_sysop = FALSE;
|
chat_with_sysop = FALSE;
|
||||||
@ -377,7 +377,7 @@ void Chat(char *username, char *channel)
|
|||||||
/*
|
/*
|
||||||
* Close server connection
|
* Close server connection
|
||||||
*/
|
*/
|
||||||
sprintf(buf, "CCLO,1,%d;", mypid);
|
snprintf(buf, 200, "CCLO,1,%d;", mypid);
|
||||||
Syslog('c', "> %s", buf);
|
Syslog('c', "> %s", buf);
|
||||||
if (socket_send(buf) == 0) {
|
if (socket_send(buf) == 0) {
|
||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
|
@ -63,7 +63,7 @@ int TotalUsers(void)
|
|||||||
struct userrec u;
|
struct userrec u;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
snprintf(temp, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||||
if(( pUsrConfig = fopen(temp,"rb")) == NULL)
|
if(( pUsrConfig = fopen(temp,"rb")) == NULL)
|
||||||
WriteError("ControlCodeK: Can't open users file %s for reading", temp);
|
WriteError("ControlCodeK: Can't open users file %s for reading", temp);
|
||||||
else {
|
else {
|
||||||
@ -97,7 +97,7 @@ void DisplayRules(void)
|
|||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
int Found = FALSE;
|
int Found = FALSE;
|
||||||
char temp[128];
|
char temp[PATH_MAX];
|
||||||
|
|
||||||
if ((dp = opendir(CFG.rulesdir)) == NULL) {
|
if ((dp = opendir(CFG.rulesdir)) == NULL) {
|
||||||
WriteError("$Can't open directory %s", CFG.rulesdir);
|
WriteError("$Can't open directory %s", CFG.rulesdir);
|
||||||
@ -114,21 +114,21 @@ void DisplayRules(void)
|
|||||||
strcpy(temp, msgs.Tag);
|
strcpy(temp, msgs.Tag);
|
||||||
if (strcasecmp(de->d_name, temp) == 0) {
|
if (strcasecmp(de->d_name, temp) == 0) {
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name);
|
snprintf(temp, PATH_MAX, "%s/%s", CFG.rulesdir, de->d_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sprintf(temp, "%s.rul", temp);
|
snprintf(temp, PATH_MAX, "%s.rul", temp);
|
||||||
if (strcasecmp(de->d_name, temp) == 0) {
|
if (strcasecmp(de->d_name, temp) == 0) {
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name);
|
snprintf(temp, PATH_MAX, "%s/%s", CFG.rulesdir, de->d_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memset(&temp, 0, sizeof(temp));
|
memset(&temp, 0, sizeof(temp));
|
||||||
strncpy(temp, msgs.Tag, 8);
|
strncpy(temp, msgs.Tag, 8);
|
||||||
sprintf(temp, "%s.rul", temp);
|
snprintf(temp, PATH_MAX, "%s.rul", temp);
|
||||||
if (strcasecmp(de->d_name, temp) == 0) {
|
if (strcasecmp(de->d_name, temp) == 0) {
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name);
|
snprintf(temp, PATH_MAX, "%s/%s", CFG.rulesdir, de->d_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,16 +247,16 @@ int DisplayFile(char *filename)
|
|||||||
*/
|
*/
|
||||||
pFileName = NULL;
|
pFileName = NULL;
|
||||||
if (exitinfo.GraphMode) {
|
if (exitinfo.GraphMode) {
|
||||||
sprintf(newfile, "%s/%s.ans", lang.TextPath, filename);
|
snprintf(newfile, PATH_MAX, "%s/%s.ans", lang.TextPath, filename);
|
||||||
if ((pFileName = fopen(newfile, "rb")) == NULL) {
|
if ((pFileName = fopen(newfile, "rb")) == NULL) {
|
||||||
sprintf(newfile, "%s/%s.ans", CFG.bbs_txtfiles, filename);
|
snprintf(newfile, PATH_MAX, "%s/%s.ans", CFG.bbs_txtfiles, filename);
|
||||||
pFileName = fopen(newfile, "rb");
|
pFileName = fopen(newfile, "rb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pFileName == NULL) {
|
if (pFileName == NULL) {
|
||||||
sprintf(newfile, "%s/%s.asc", lang.TextPath, filename);
|
snprintf(newfile, PATH_MAX, "%s/%s.asc", lang.TextPath, filename);
|
||||||
if ((pFileName = fopen(newfile, "rb")) == NULL) {
|
if ((pFileName = fopen(newfile, "rb")) == NULL) {
|
||||||
sprintf(newfile, "%s/%s.asc", CFG.bbs_txtfiles, filename);
|
snprintf(newfile, PATH_MAX, "%s/%s.asc", CFG.bbs_txtfiles, filename);
|
||||||
if ((pFileName = fopen(newfile, "rb")) == NULL) {
|
if ((pFileName = fopen(newfile, "rb")) == NULL) {
|
||||||
free(sFileName);
|
free(sFileName);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
@ -297,7 +297,7 @@ int DisplayFile(char *filename)
|
|||||||
x++;
|
x++;
|
||||||
strcpy(tmp1, "");
|
strcpy(tmp1, "");
|
||||||
while (*(sFileName + x) != '') {
|
while (*(sFileName + x) != '') {
|
||||||
sprintf(tmp, "%c", *(sFileName + x));
|
snprintf(tmp, PATH_MAX, "%c", *(sFileName + x));
|
||||||
strcat(tmp1, tmp);
|
strcat(tmp1, tmp);
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
@ -357,50 +357,50 @@ void ControlCodeF(int ch)
|
|||||||
|
|
||||||
switch (toupper(ch)) {
|
switch (toupper(ch)) {
|
||||||
case '!':
|
case '!':
|
||||||
sprintf(temp, "%s", exitinfo.sProtocol);
|
snprintf(temp, 81, "%s", exitinfo.sProtocol);
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
sprintf(temp, "%ld", exitinfo.Uploads);
|
snprintf(temp, 81, "%ld", exitinfo.Uploads);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
sprintf(temp, "%ld", exitinfo.Downloads);
|
snprintf(temp, 81, "%ld", exitinfo.Downloads);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
sprintf(temp, "%lu", exitinfo.DownloadK);
|
snprintf(temp, 81, "%lu", exitinfo.DownloadK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
sprintf(temp, "%lu", exitinfo.UploadK);
|
snprintf(temp, 81, "%lu", exitinfo.UploadK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'E':
|
case 'E':
|
||||||
sprintf(temp, "%lu", exitinfo.DownloadK + exitinfo.UploadK);
|
snprintf(temp, 81, "%lu", exitinfo.DownloadK + exitinfo.UploadK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
sprintf(temp, "%lu", LIMIT.DownK);
|
snprintf(temp, 81, "%lu", LIMIT.DownK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'H':
|
case 'H':
|
||||||
sprintf(temp, "%d", iAreaNumber);
|
snprintf(temp, 81, "%d", iAreaNumber);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I':
|
case 'I':
|
||||||
sprintf(temp, "%s", sAreaDesc);
|
snprintf(temp, 81, "%s", sAreaDesc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
sprintf(temp, "%u", LIMIT.DownF);
|
snprintf(temp, 81, "%u", LIMIT.DownF);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
sprintf(temp, "%s", LIMIT.Description);
|
snprintf(temp, 81, "%s", LIMIT.Description);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sprintf(temp, " ");
|
snprintf(temp, 81, " ");
|
||||||
}
|
}
|
||||||
PUTSTR(temp);
|
PUTSTR(temp);
|
||||||
}
|
}
|
||||||
@ -419,147 +419,147 @@ void ControlCodeU(int ch)
|
|||||||
|
|
||||||
switch (toupper(ch)) {
|
switch (toupper(ch)) {
|
||||||
case 'A':
|
case 'A':
|
||||||
sprintf(temp, "%s", exitinfo.sUserName);
|
snprintf(temp, 81, "%s", exitinfo.sUserName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
sprintf(temp, "%s", exitinfo.sLocation);
|
snprintf(temp, 81, "%s", exitinfo.sLocation);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
sprintf(temp, "%s", exitinfo.sVoicePhone);
|
snprintf(temp, 81, "%s", exitinfo.sVoicePhone);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
sprintf(temp, "%s", exitinfo.sDataPhone);
|
snprintf(temp, 81, "%s", exitinfo.sDataPhone);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'E':
|
case 'E':
|
||||||
sprintf(temp, "%s", LastLoginDate);
|
snprintf(temp, 81, "%s", LastLoginDate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
sprintf(temp, "%s %s", StrDateDMY(exitinfo.tFirstLoginDate), StrTimeHMS(exitinfo.tFirstLoginDate));
|
snprintf(temp, 81, "%s %s", StrDateDMY(exitinfo.tFirstLoginDate), StrTimeHMS(exitinfo.tFirstLoginDate));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'G':
|
case 'G':
|
||||||
sprintf(temp, "%s", LastLoginTime);
|
snprintf(temp, 81, "%s", LastLoginTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'H':
|
case 'H':
|
||||||
sprintf(temp, "%d", exitinfo.Security.level);
|
snprintf(temp, 81, "%d", exitinfo.Security.level);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I':
|
case 'I':
|
||||||
sprintf(temp, "%d", exitinfo.iTotalCalls);
|
snprintf(temp, 81, "%d", exitinfo.iTotalCalls);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
sprintf(temp, "%d", exitinfo.iTimeUsed);
|
snprintf(temp, 81, "%d", exitinfo.iTimeUsed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
sprintf(temp, "%d", exitinfo.iConnectTime);
|
snprintf(temp, 81, "%d", exitinfo.iConnectTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
sprintf(temp, "%d", exitinfo.iTimeLeft);
|
snprintf(temp, 81, "%d", exitinfo.iTimeLeft);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
sprintf(temp, "%d", exitinfo.iScreenLen);
|
snprintf(temp, 81, "%d", exitinfo.iScreenLen);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
sprintf(temp, "%s", FirstName);
|
snprintf(temp, 81, "%s", FirstName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
sprintf(temp, "%s", LastName);
|
snprintf(temp, 81, "%s", LastName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Q':
|
case 'Q':
|
||||||
sprintf(temp, "%s", exitinfo.ieNEWS ? (char *) Language(147) : (char *) Language(148));
|
snprintf(temp, 81, "%s", exitinfo.ieNEWS ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
sprintf(temp, "%s", exitinfo.GraphMode ? (char *) Language(147) : (char *) Language(148));
|
snprintf(temp, 81, "%s", exitinfo.GraphMode ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
sprintf(temp, "%s", exitinfo.HotKeys ? (char *) Language(147) : (char *) Language(148));
|
snprintf(temp, 81, "%s", exitinfo.HotKeys ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
sprintf(temp, "%d", exitinfo.iTimeUsed + exitinfo.iTimeLeft);
|
snprintf(temp, 81, "%d", exitinfo.iTimeUsed + exitinfo.iTimeLeft);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
sprintf(temp, "%s", exitinfo.sDateOfBirth);
|
snprintf(temp, 81, "%s", exitinfo.sDateOfBirth);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'U':
|
case 'U':
|
||||||
sprintf(temp, "%d", exitinfo.iPosted);
|
snprintf(temp, 81, "%d", exitinfo.iPosted);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
sprintf(temp, "%s", lang.Name);
|
snprintf(temp, 81, "%s", lang.Name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y':
|
case 'Y':
|
||||||
sprintf(temp, "%s", exitinfo.sHandle);
|
snprintf(temp, 81, "%s", exitinfo.sHandle);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Z':
|
case 'Z':
|
||||||
sprintf(temp, "%s", exitinfo.DoNotDisturb ? (char *) Language(147) : (char *) Language(148));
|
snprintf(temp, 81, "%s", exitinfo.DoNotDisturb ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
sprintf(temp, "%s", exitinfo.MailScan ? (char *) Language(147) : (char *) Language(148));
|
snprintf(temp, 81, "%s", exitinfo.MailScan ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '2':
|
case '2':
|
||||||
sprintf(temp, "%s", exitinfo.ieFILE ? (char *) Language(147) : (char *) Language(148));
|
snprintf(temp, 81, "%s", exitinfo.ieFILE ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '3':
|
case '3':
|
||||||
switch(exitinfo.MsgEditor) {
|
switch(exitinfo.MsgEditor) {
|
||||||
case LINEEDIT: sprintf(temp, "%s", Language(387));
|
case LINEEDIT: snprintf(temp, 81, "%s", Language(387));
|
||||||
break;
|
break;
|
||||||
case FSEDIT: sprintf(temp, "%s", Language(388));
|
case FSEDIT: snprintf(temp, 81, "%s", Language(388));
|
||||||
break;
|
break;
|
||||||
case EXTEDIT: sprintf(temp, "%s", Language(389));
|
case EXTEDIT: snprintf(temp, 81, "%s", Language(389));
|
||||||
break;
|
break;
|
||||||
default: sprintf(temp, "?");
|
default: snprintf(temp, 81, "?");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '4':
|
case '4':
|
||||||
sprintf(temp, "%s", exitinfo.FSemacs ? (char *) Language(147) : (char *) Language(148));
|
snprintf(temp, 81, "%s", exitinfo.FSemacs ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '5':
|
case '5':
|
||||||
sprintf(temp, "%s", exitinfo.address[0]);
|
snprintf(temp, 81, "%s", exitinfo.address[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '6':
|
case '6':
|
||||||
sprintf(temp, "%s", exitinfo.address[1]);
|
snprintf(temp, 81, "%s", exitinfo.address[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '7':
|
case '7':
|
||||||
sprintf(temp, "%s", exitinfo.address[2]);
|
snprintf(temp, 81, "%s", exitinfo.address[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '8':
|
case '8':
|
||||||
sprintf(temp, "%s", exitinfo.OL_ExtInfo ? (char *) Language(147) : (char *) Language(148));
|
snprintf(temp, 81, "%s", exitinfo.OL_ExtInfo ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '9':
|
case '9':
|
||||||
sprintf(temp, "%s", getftnchrs(exitinfo.Charset));
|
snprintf(temp, 81, "%s", getftnchrs(exitinfo.Charset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sprintf(temp, " ");
|
snprintf(temp, 81, " ");
|
||||||
}
|
}
|
||||||
PUTSTR(temp);
|
PUTSTR(temp);
|
||||||
}
|
}
|
||||||
@ -574,57 +574,57 @@ void ControlCodeK(int ch)
|
|||||||
|
|
||||||
switch (toupper(ch)) {
|
switch (toupper(ch)) {
|
||||||
case 'A':
|
case 'A':
|
||||||
sprintf(temp, "%s", (char *) GetDateDMY());
|
snprintf(temp, 81, "%s", (char *) GetDateDMY());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
sprintf(temp, "%s", (char *) GetLocalHMS());
|
snprintf(temp, 81, "%s", (char *) GetLocalHMS());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
sprintf(temp, "%s", (char *) GLCdate());
|
snprintf(temp, 81, "%s", (char *) GLCdate());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
sprintf(temp, "%s", (char *) GLCdateyy());
|
snprintf(temp, 81, "%s", (char *) GLCdateyy());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'E':
|
case 'E':
|
||||||
sprintf(temp, "%ld", Speed());
|
snprintf(temp, 81, "%ld", Speed());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
sprintf(temp, "%s", LastCaller);
|
snprintf(temp, 81, "%s", LastCaller);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'G':
|
case 'G':
|
||||||
sprintf(temp, "%d", TotalUsers());
|
snprintf(temp, 81, "%d", TotalUsers());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'H':
|
case 'H':
|
||||||
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
snprintf(sDataFile, PATH_MAX, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
||||||
if((pCallerLog = fopen(sDataFile, "rb")) != NULL) {
|
if((pCallerLog = fopen(sDataFile, "rb")) != NULL) {
|
||||||
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
|
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
|
||||||
sprintf(temp, "%ld", SYSINFO.SystemCalls);
|
snprintf(temp, 81, "%ld", SYSINFO.SystemCalls);
|
||||||
fclose(pCallerLog);
|
fclose(pCallerLog);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I':
|
case 'I':
|
||||||
sprintf(temp, "%d", iMsgAreaNumber + 1);
|
snprintf(temp, 81, "%d", iMsgAreaNumber + 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
sprintf(temp, "%s", sMsgAreaDesc);
|
snprintf(temp, 81, "%s", sMsgAreaDesc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
sprintf(temp, "%s", Oneliner_Get());
|
snprintf(temp, 81, "%s", Oneliner_Get());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
SetMsgArea(iMsgAreaNumber);
|
SetMsgArea(iMsgAreaNumber);
|
||||||
sprintf(temp, "%ld", MsgBase.Total);
|
snprintf(temp, 81, "%ld", MsgBase.Total);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
@ -633,42 +633,42 @@ void ControlCodeK(int ch)
|
|||||||
if (Msg_GetLastRead(&LR) == TRUE) {
|
if (Msg_GetLastRead(&LR) == TRUE) {
|
||||||
if (LR.HighReadMsg > MsgBase.Highest)
|
if (LR.HighReadMsg > MsgBase.Highest)
|
||||||
LR.HighReadMsg = MsgBase.Highest;
|
LR.HighReadMsg = MsgBase.Highest;
|
||||||
sprintf(temp, "%ld", LR.HighReadMsg);
|
snprintf(temp, 81, "%ld", LR.HighReadMsg);
|
||||||
} else
|
} else
|
||||||
sprintf(temp, "?");
|
snprintf(temp, 81, "?");
|
||||||
Msg_Close();
|
Msg_Close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
sprintf(temp, "%s", sMailbox);
|
snprintf(temp, 81, "%s", sMailbox);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
SetEmailArea(sMailbox);
|
SetEmailArea(sMailbox);
|
||||||
sprintf(temp, "%ld", EmailBase.Total);
|
snprintf(temp, 81, "%ld", EmailBase.Total);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
sprintf(sDataFile, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, sMailbox);
|
snprintf(sDataFile, PATH_MAX, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, sMailbox);
|
||||||
LR.UserID = grecno;
|
LR.UserID = grecno;
|
||||||
if (Msg_Open(sDataFile)) {
|
if (Msg_Open(sDataFile)) {
|
||||||
if (Msg_GetLastRead(&LR) == TRUE) {
|
if (Msg_GetLastRead(&LR) == TRUE) {
|
||||||
if (LR.HighReadMsg > EmailBase.Highest)
|
if (LR.HighReadMsg > EmailBase.Highest)
|
||||||
LR.HighReadMsg = EmailBase.Highest;
|
LR.HighReadMsg = EmailBase.Highest;
|
||||||
sprintf(temp, "%ld", LR.HighReadMsg);
|
snprintf(temp, 81, "%ld", LR.HighReadMsg);
|
||||||
} else
|
} else
|
||||||
sprintf(temp, "?");
|
snprintf(temp, 81, "?");
|
||||||
Msg_Close();
|
Msg_Close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Q':
|
case 'Q':
|
||||||
sprintf(temp, "%s %s", StrDateDMY(LastCallerTime), StrTimeHMS(LastCallerTime));
|
snprintf(temp, 81, "%s %s", StrDateDMY(LastCallerTime), StrTimeHMS(LastCallerTime));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sprintf(temp, " ");
|
snprintf(temp, 81, " ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user