[geany/geany] 61c521: Fix an off-by-one issue in C macro parsing code

Colomban Wendling git-noreply at xxxxx
Sat Aug 25 13:50:09 UTC 2012


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 25 Aug 2012 13:50:09
Commit:      61c5216083a916af46c1150f1b4f4a7102c4a25b
             https://github.com/geany/geany/commit/61c5216083a916af46c1150f1b4f4a7102c4a25b

Log Message:
-----------
Fix an off-by-one issue in C macro parsing code

Closes #3556536.


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

Modified: tagmanager/ctags/get.c
6 files changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -722,10 +722,10 @@ extern char *getArglistFromFilePos(MIOPos startPosition, const char *tokenName)
 
 	if (pos2 > pos1)
 	{
-		result = (char *) g_malloc(sizeof(char ) * (pos2 - pos1 + 2));
-		if (result != NULL && mio_read(File.mio, result, sizeof(char), pos2 - pos1 + 1) > 0)
+		result = (char *) g_malloc(sizeof(char ) * (pos2 - pos1 + 1));
+		if (result != NULL && mio_read(File.mio, result, sizeof(char), pos2 - pos1) > 0)
 		{
-			result[pos2-pos1+1] = '\0';
+			result[pos2-pos1] = '\0';
 			arglist = getArglistFromStr(result, tokenName);
 		}
 		g_free(result);


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list