[geany/geany] 68322f: ruby: fix wrong memory access in catMatch

Masatake YAMATO git-noreply at xxxxx
Mon Mar 14 18:27:21 UTC 2016


Branch:      refs/heads/master
Author:      Masatake YAMATO <yamato at redhat.com>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 14 Mar 2016 18:27:21 UTC
Commit:      68322fcb54bda53137429321c58000b2683fc2d8
             https://github.com/geany/geany/commit/68322fcb54bda53137429321c58000b2683fc2d8

Log Message:
-----------
ruby: fix wrong memory access in catMatch

fuzz target reports canMatch access wrong memory
area when php-anonymous_functions.d/input.php is
given as input.

This patch fixes it.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>


Modified Paths:
--------------
    tagmanager/ctags/ruby.c

Modified: tagmanager/ctags/ruby.c
5 lines changed, 5 insertions(+), 0 deletions(-)
===================================================================
@@ -81,6 +81,11 @@ static vString* stringListToScope (const stringList* list)
 static boolean canMatch (const unsigned char** s, const char* literal)
 {
 	const int literal_length = strlen (literal);
+	const int s_length = strlen ((const char *)*s);
+
+	if (s_length < literal_length)
+		return FALSE;
+
 	const unsigned char next_char = *(*s + literal_length);
 	if (strncmp ((const char*) *s, literal, literal_length) != 0)
 	{



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list