bad_empabb_value:
- strncpy(str, "---", 3);
+ strncpy(str, "---", 4);
return str;
}
{
size_t len = strlen(val);
size_t total = strlen((char *) loc);
+ char temp[BUFFER_LEN];
/* truncate if necessary */
if (len + total + 1 >= (size_t) maxval) {
if (source == 0)
do_rawlog(LT_ERR, T("CONFIG: option %s value truncated\n"), opt);
}
- sprintf((char *) loc, "%s %s", (char *) loc, val);
+ snprintf(temp, sizeof temp, "%s %s", (char *) loc, val);
+ strncpy(loc, temp, maxval);
return 1;
}
count = 0;
do {
name[BUFFER_LEN - 6] = '\0';
- sprintf(tbuf1, "%s%d", name, count);
+ snprintf(tbuf1, sizeof tbuf1, "%.1018s%d", name, count);
count++;
} while (count < 10000 && atr_get_noparent(i, tbuf1));
strcpy(name, tbuf1);
channel_description(dbref player)
{
static char buf[BUFFER_LEN];
+ char *bp;
CHANLIST *c;
- *buf = '\0';
+ bp = buf;
if (Chanlist(player)) {
- strcpy(buf, T("Channels:"));
+ safe_str(T("Channels:"), buf, &bp);
for (c = Chanlist(player); c; c = c->next)
- sprintf(buf, "%s %s", buf, ChanName(c->chan));
+ safe_chr(' ', buf, &bp);
+ safe_str(ChanName(c->chan), buf, &bp);
} else if (IsPlayer(player))
- strcpy(buf, T("Channels: *NONE*"));
+ safe_str(T("Channels: *NONE*"), buf, &bp);
+
+ *bp = '\0';
return buf;
}
safe_str(T(e_perm), buff, bp);
return;
}
- do_link(executor, args[0], args[1], args[2] && args[2] != '\0' ? parse_boolean(args[2]) : 0 );
+ do_link(executor, args[0], args[1], args[2] && *args[2] != '\0' ? parse_boolean(args[2]) : 0 );
}
/* ARGSUSED */
ENTER_OOREF;
if (nargs > 3) {
- if (args[3] != '\0') {
+ if (*args[3] != '\0') {
/* we have a transform attr */
transform = 1;
if (!fetch_ufun_attrib(args[3], executor, &transufun, 1)) {
return;
}
if (nargs > 4) {
- if (args[4] != '\0') {
+ if (*args[4] != '\0') {
/* we have an attr to use when transform returns an empty string */
null = 1;
if (!fetch_ufun_attrib(args[4], executor, &nullufun, 1)) {
}
}
- if (nargs < 6 || args[5] == '\0')
+ if (nargs < 6 || *args[5] == '\0')
open = (char *) "\"";
else
open = args[5];
- if (nargs < 7 || args[6] == '\0')
+ if (nargs < 7 || *args[6] == '\0')
close = open;
else
close = args[6];
paranoid_checkpt = 1;
#endif
if(options.flagdb[0] != '\0') {
- sprintf(realdumpfile, "%s%s", options.flagdb, options.compresssuff);
+ snprintf(realdumpfile, sizeof realdumpfile, "%.1790s%s", options.flagdb,
+ options.compresssuff);
strcpy(tmpfl, make_new_epoch_file(options.flagdb, epoch));
- sprintf(realtmpfl, "%s%s", tmpfl, options.compresssuff);
+ snprintf(realtmpfl, sizeof realtmpfl, "%.1790s%s", tmpfl,
+ options.compresssuff);
if((f = db_open_write(tmpfl)) != NULL) {
use_flagfile = 1;
db_write_flag_db(f);
}
}
- sprintf(realdumpfile, "%s%s", globals.dumpfile, options.compresssuff);
+ snprintf(realdumpfile, sizeof realdumpfile, "%.1790s%s", globals.dumpfile,
+ options.compresssuff);
strcpy(tmpfl, make_new_epoch_file(globals.dumpfile, epoch));
- sprintf(realtmpfl, "%s%s", tmpfl, options.compresssuff);
+ snprintf(realtmpfl, sizeof realtmpfl, "%.1790s%s", tmpfl,
+ options.compresssuff);
if ((f = db_open_write(tmpfl)) != NULL) {
switch (globals.paranoid_dump) {
longjmp(db_err, 1);
}
#ifdef USE_MAILER
- sprintf(realdumpfile, "%s%s", options.mail_db, options.compresssuff);
+ snprintf(realdumpfile, sizeof realdumpfile, "%.1790s%s", options.mail_db,
+ options.compresssuff);
strcpy(tmpfl, make_new_epoch_file(options.mail_db, epoch));
- sprintf(realtmpfl, "%s%s", tmpfl, options.compresssuff);
+ snprintf(realtmpfl, sizeof realtmpfl, "%.1790s%s", tmpfl,
+ options.compresssuff);
if (mdb_top >= 0) {
if ((f = db_open_write(tmpfl)) != NULL) {
dump_mail(f);
}
#endif
#ifdef CHAT_SYSTEM
- sprintf(realdumpfile, "%s%s", options.chatdb, options.compresssuff);
+ snprintf(realdumpfile, sizeof realdumpfile, "%.1790s%s", options.chatdb,
+ options.compresssuff);
strcpy(tmpfl, make_new_epoch_file(options.chatdb, epoch));
- sprintf(realtmpfl, "%s%s", tmpfl, options.compresssuff);
+ snprintf(realtmpfl, sizeof realtmpfl, "%.1790s%s", tmpfl,
+ options.compresssuff);
if ((f = db_open_write(tmpfl)) != NULL) {
save_chatdb(f);
db_close(f);
getnameinfo(faddr, flen, NULL, 0, port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV);
strncat(buf, port, sizeof(buf));
- strncat(buf, "\r\n", sizeof(buf));
+ strncat(buf, "\r\n", sizeof(buf) - 1);
if (timeout) {
time_t now, after;
for (c = 0; c < 16; c++)
start_bits[c] |= tcode[c];
for (c = 128; c < 256; c++) {
- if ((tcode[c / 8] && (1 << (c & 7))) != 0) {
+ if (tcode[c / 8] && ((1 << (c & 7)) != 0)) {
int d = (c >> 6) | 0xc0; /* Set bit for this starter */
start_bits[d / 8] |= (1 << (d & 7)); /* and then skip on to the */
c = (c & 0xc0) + 0x40 - 1; /* next relevant character. */
*rbp = '\0';
if (PromptConnection(d)) {
if (ShowAnsiColor(d->player))
- snprintf(buf, BUFFER_LEN - 1, "%s %c%c", rbuf, IAC, GOAHEAD);
+ snprintf(buf, BUFFER_LEN - 1, "%.2045s %c%c", rbuf, IAC, GOAHEAD);
else
- snprintf(buf, BUFFER_LEN - 1, "%s %c%c",
+ snprintf(buf, BUFFER_LEN - 1, "%.2045s %c%c",
remove_markup(rbuf, NULL), IAC, GOAHEAD);
} else {
if (ShowAnsiColor(d->player))
- snprintf(buf, BUFFER_LEN - 1, "%s\r\n", rbuf);
+ snprintf(buf, BUFFER_LEN - 1, "%.2045s\r\n", rbuf);
else
snprintf(buf, BUFFER_LEN - 1, "%s\r\n", remove_markup(rbuf, NULL));
}