summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-06-18 16:46:05 +0000
committerRichard M. Stallman <rms@gnu.org>1997-06-18 16:46:05 +0000
commit089e3cb0acf24f8c182f81192ab52b6c6211f05d (patch)
treeb2bef7436b1c97fe7fe21d4e503497dcdbd08c11 /src/editfns.c
parentd576ef75bc395d5074651fbfbb419a9f6a19d78f (diff)
downloademacs-089e3cb0acf24f8c182f81192ab52b6c6211f05d.tar.gz
(Fchar_before): Validate N after decrementing.
Don't use POS as integer.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/editfns.c b/src/editfns.c
index ccd2e6fb367..c4cc3019708 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -608,19 +608,21 @@ is returned as a character.")
CHECK_NUMBER_COERCE_MARKER (pos, 0);
n = XINT (pos);
- if (n < BEGV || n >= ZV)
- return Qnil;
}
if (!NILP (current_buffer->enable_multibyte_characters))
{
- DEC_POS (pos);
- XSETFASTINT (val, FETCH_CHAR (pos));
+ DEC_POS (n);
+ if (n < BEGV || n >= ZV)
+ return Qnil;
+ XSETFASTINT (val, FETCH_CHAR (n));
}
else
{
- pos--;
- XSETFASTINT (val, FETCH_BYTE (pos));
+ n--;
+ if (n < BEGV || n >= ZV)
+ return Qnil;
+ XSETFASTINT (val, FETCH_BYTE (n));
}
return val;
}