diff --git a/src/spec_procs.c b/src/spec_procs.c index 0b23149..d75050e 100644 --- a/src/spec_procs.c +++ b/src/spec_procs.c @@ -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))