q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=cc0476041f9d879adf8a0af9813c3193fc495c96

commit cc0476041f9d879adf8a0af9813c3193fc495c96
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Sun Oct 4 14:52:36 2015 +0100

    eolian: fix out-of-bounds indexing on tokens
    
    Fixes CID 1324818 @fix
---
 src/lib/eolian/eo_lexer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index bd78958..d14c70f 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -1148,8 +1148,9 @@ eo_lexer_token_to_str(int token, char *buf)
      {
         const char *v;
         size_t idx = token - START_CUSTOM;
-        if (idx >= sizeof(tokens))
-          v = keywords[idx - sizeof(tokens)];
+        size_t tsz = sizeof(tokens) / sizeof(tokens[0]);
+        if (idx >= tsz)
+          v = keywords[idx - tsz];
         else
           v = tokens[idx];
         memcpy(buf, v, strlen(v) + 1);

-- 


Reply via email to