begin_critical_section(S_PUBLIC_CLIENTS);
lprintf(CTDL_INFO, "Loading %s\n", PUBLIC_CLIENTS);
- strcpy(public_clients, "127.0.0.1");
+ safestrncpy(public_clients, "127.0.0.1", sizeof public_clients);
if (hostname_to_dotted_quad(addrbuf, config.c_fqdn) == 0) {
strcat(public_clients, "|");
strcat(public_clients, addrbuf);
extract_token(buf, mname, 0, '|', sizeof buf);
- dirs[0]=malloc(64);
- dirs[1]=malloc(64);
- strcpy(dirs[0],"messages");
- strcpy(dirs[1],"help");
+ dirs[0] = strdup("messages");
+ dirs[1] = strdup("help");
snprintf(buf2, sizeof buf2, "%s.%d.%d", buf, CC->cs_clientdev, CC->cs_clienttyp);
mesg_locate(targ, sizeof targ, buf2, 2, (const char **)dirs);
if (strlen(targ) == 0) {
/* For my own mailbox rooms, chop off the owner prefix */
if ( (qrbuf->QRflags & QR_MAILBOX)
&& (atol(qrbuf->QRname) == CC->user.usernum) ) {
- strcpy(truncated_roomname, qrbuf->QRname);
- strcpy(truncated_roomname, &truncated_roomname[11]);
+ safestrncpy(truncated_roomname, qrbuf->QRname, sizeof truncated_roomname);
+ safestrncpy(truncated_roomname, &truncated_roomname[11], sizeof truncated_roomname);
cprintf("%s", truncated_roomname);
}
/* For all other rooms, just display the name in its entirety */
else
raideflag = 0;
- strcpy(truncated_roomname, CC->room.QRname);
+ safestrncpy(truncated_roomname, CC->room.QRname, sizeof truncated_roomname);
if ( (CC->room.QRflags & QR_MAILBOX)
&& (atol(CC->room.QRname) == CC->user.usernum) ) {
- strcpy(truncated_roomname, &truncated_roomname[11]);
+ safestrncpy(truncated_roomname, &truncated_roomname[11], sizeof truncated_roomname);
}
if (retmsgs != NULL) *retmsgs = total_messages;
*/
void cmd_rdir(void)
{
- char buf[SIZ];
- char flnm[SIZ];
- char comment[SIZ];
+ char buf[256];
+ char flnm[256];
+ char comment[256];
FILE *ls, *fd;
struct stat statbuf;
snprintf(buf, sizeof buf, "%s/files/%s/%s",
BBSDIR, CC->room.QRdirname, flnm);
stat(buf, &statbuf);
- strcpy(comment, "");
+ safestrncpy(comment, "", sizeof comment);
fseek(fd, 0L, 0);
while ((fgets(buf, sizeof buf, fd) != NULL)
&& (strlen(comment) == 0)) {
struct floor *fl;
struct floor flbuf;
long owner = 0L;
- char actual_old_name[SIZ];
+ char actual_old_name[ROOMNAMELEN];
lprintf(CTDL_DEBUG, "CtdlRenameRoom(%s, %s, %d)\n",
old_name, new_name, new_floor);
else {
/* Rename it */
- strcpy(actual_old_name, qrbuf.QRname);
+ safestrncpy(actual_old_name, qrbuf.QRname, sizeof actual_old_name);
if (qrbuf.QRflags & QR_MAILBOX) {
owner = atol(qrbuf.QRname);
}
if (CC->room.QRflags & QR_MAILBOX) {
sprintf(new_name, "%010ld.", atol(CC->room.QRname) );
} else {
- strcpy(new_name, "");
+ safestrncpy(new_name, "", sizeof new_name);
}
extract_token(&new_name[strlen(new_name)], args, 0, '|', (sizeof new_name - strlen(new_name)));
}
if (kill_ok) {
if (CC->room.QRflags & QR_MAILBOX) {
- strcpy(deleted_room_name, &CC->room.QRname[11]);
+ safestrncpy(deleted_room_name, &CC->room.QRname[11], sizeof deleted_room_name);
}
else {
- strcpy(deleted_room_name, CC->room.QRname);
+ safestrncpy(deleted_room_name, CC->room.QRname, sizeof deleted_room_name);
}
/* Do the dirty work */