jed-users mailing list

[2009 Date Index] [2009 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[PATCH 1/2] load_dfa: Fix size of buffer equiv


The buffer equiv must have UCHAR_MAX + 1 elements to save all the
elements as in Highlight.equiv. Because the check for the upper boundary
was on <= UCHAR_MAX the (UCHAR_MAX+1)th element was touched which caused
a stack corruption and an abort if jed was compiled with -fstack-protect.
---
 src/dfasyntx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/dfasyntx.c b/src/dfasyntx.c
index e5759a8..ee9c0b0 100644
--- a/src/dfasyntx.c
+++ b/src/dfasyntx.c
@@ -765,7 +765,7 @@ static int load_dfa (Highlight *h, char *name)
 {
    FILE *fp;
    char buffer[2048], buf2[2048];
-   unsigned char equiv[UCHAR_MAX];
+   unsigned char equiv[UCHAR_MAX+1];
    int i, j;
    Accept *accept = NULL;
    int accepts;
-- 
1.6.0.6


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2009 date index] [2009 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]