do not look beyond the end of the buffer

This commit is contained in:
Nick Clifton
1999-11-12 11:02:56 +00:00
parent c1eae11499
commit 035349a40d
2 changed files with 7 additions and 2 deletions

View File

@@ -246,10 +246,10 @@ buffer_and_nest (from, to, ptr, get_line)
if (ptr->ptr[i] == '.')
i++;
if (strncasecmp (ptr->ptr + i, from, from_len) == 0
&& ! isalnum (ptr->ptr[i + from_len]))
&& (ptr->len == (i + from_len || ! isalnum (ptr->ptr[i + from_len]))))
depth++;
if (strncasecmp (ptr->ptr + i, to, to_len) == 0
&& ! isalnum (ptr->ptr[i + to_len]))
&& (ptr->len == (i + to_len) || ! isalnum (ptr->ptr[i + to_len])))
{
depth--;
if (depth == 0)