Update spec_procs.c

This commit is contained in:
Rumble 2014-05-03 19:49:20 -04:00
parent f0d48f8507
commit 0cfdaa2081

View file

@ -100,7 +100,7 @@ void list_skills(struct char_data *ch)
{
const char *overflow = "\r\n**OVERFLOW**\r\n";
int i, sortpos, ret;
size_t len = 0, nlen;
size_t len = 0;
char buf2[MAX_STRING_LENGTH];
len = snprintf(buf2, sizeof(buf2), "You have %d practice session%s remaining.\r\n"
@ -111,9 +111,9 @@ void list_skills(struct char_data *ch)
i = spell_sort_info[sortpos];
if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
ret = snprintf(buf2 + len, sizeof(buf2) - len, "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i)));
if (len + nlen >= sizeof(buf2) || ret < 0)
if (ret < 0 || len + ret >= sizeof(buf2))
break;
len += nlen;
len += ret;
}
}
if (len >= sizeof(buf2))