diff --git a/src/act.wizard.c b/src/act.wizard.c index 9091eb0..55daf66 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -1936,8 +1936,10 @@ void add_llog_entry(struct char_data *ch, int type) { /* we didn't - make a new one */ if(llast == NULL) { /* no entry found, add ..error if close! */ CREATE(llast,struct last_entry,1); - strncpy(llast->username,GET_NAME(ch),16); - strncpy(llast->hostname,GET_HOST(ch),128); + strncpy(llast->username,GET_NAME(ch),15); + strncpy(llast->hostname,GET_HOST(ch),127); + llast->username[15]='\0'; + llast->hostname[127]='\0'; llast->idnum=GET_IDNUM(ch); llast->punique=GET_PREF(ch); llast->time=time(0); @@ -2054,8 +2056,11 @@ ACMD(do_last) num = atoi(arg); if (num < 0) num = 0; - } else + } else { strncpy(name, arg, sizeof(name)-1); + name[sizeof(name) - 1] = '\0'; + } + half_chop(argument, arg, argument); } } diff --git a/src/ban.c b/src/ban.c index 3dc7f7c..9380f2e 100644 --- a/src/ban.c +++ b/src/ban.c @@ -169,9 +169,9 @@ ACMD(do_ban) CREATE(ban_node, struct ban_list_element, 1); strncpy(ban_node->site, site, BANNED_SITE_LENGTH); /* strncpy: OK (b_n->site:BANNED_SITE_LENGTH+1) */ + ban_node->site[BANNED_SITE_LENGTH] = '\0'; for (nextchar = ban_node->site; *nextchar; nextchar++) *nextchar = LOWER(*nextchar); - ban_node->site[BANNED_SITE_LENGTH] = '\0'; strncpy(ban_node->name, GET_NAME(ch), MAX_NAME_LENGTH); /* strncpy: OK (b_n->size:MAX_NAME_LENGTH+1) */ ban_node->name[MAX_NAME_LENGTH] = '\0'; ban_node->date = time(0); diff --git a/src/dg_variables.c b/src/dg_variables.c index 2facf22..b43ba64 100644 --- a/src/dg_variables.c +++ b/src/dg_variables.c @@ -1628,7 +1628,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, void var_subst(void *go, struct script_data *sc, trig_data *trig, int type, char *line, char *buf) { - char tmp[MAX_INPUT_LENGTH], repl_str[MAX_INPUT_LENGTH]; + char tmp[MAX_INPUT_LENGTH], repl_str[MAX_INPUT_LENGTH - 1]; char *var = NULL, *field = NULL, *p = NULL; char tmp2[MAX_INPUT_LENGTH]; char *subfield_p, subfield[MAX_INPUT_LENGTH]; @@ -1722,4 +1722,5 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig, left -= len; } /* else if *p .. */ } /* while *p .. */ -} \ No newline at end of file + buf[sizeof(buf) - 1] = '\0'; +} diff --git a/src/genolc.c b/src/genolc.c index ce17600..31503f1 100644 --- a/src/genolc.c +++ b/src/genolc.c @@ -945,7 +945,8 @@ static int export_save_rooms(zone_rnum zrnum) struct extra_descr_data *xdesc; for (xdesc = room->ex_description; xdesc; xdesc = xdesc->next) { - strncpy(buf, xdesc->description, sizeof(buf)); + strncpy(buf, xdesc->description, sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; strip_cr(buf); fprintf(room_file, "E\n" "%s~\n" diff --git a/src/genwld.c b/src/genwld.c index 887b515..ce2211a 100644 --- a/src/genwld.c +++ b/src/genwld.c @@ -365,7 +365,8 @@ int save_rooms(zone_rnum rzone) struct extra_descr_data *xdesc; for (xdesc = room->ex_description; xdesc; xdesc = xdesc->next) { - strncpy(buf, xdesc->description, sizeof(buf)); + strncpy(buf, xdesc->description, sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; strip_cr(buf); fprintf(sf, "E\n" "%s~\n"