[geany/geany-plugins] ee3546: lineoperations: Fix underallocation in sortlines()

Colomban Wendling git-noreply at xxxxx
Sun Jan 17 14:36:42 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sun, 17 Jan 2016 14:36:42 UTC
Commit:      ee354655993507b7b998a3c13e4417ea0b1286af
             https://github.com/geany/geany-plugins/commit/ee354655993507b7b998a3c13e4417ea0b1286af

Log Message:
-----------
lineoperations: Fix underallocation in sortlines()

An overlooked operator priority lead to underallocating
`sizeof(gchar*)-1` bytes, later leading to an invalid memory access.


Modified Paths:
--------------
    lineoperations/src/linefunctions.c

Modified: lineoperations/src/linefunctions.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -295,7 +295,7 @@ void sortlines(GeanyDocument *doc, gboolean asc) {
 
 	total_num_chars = sci_get_length(doc->editor->sci);
 	total_num_lines = sci_get_line_count(doc->editor->sci);
-	lines           = g_malloc(sizeof(gchar *) * total_num_lines+1);
+	lines           = g_malloc(sizeof(gchar *) * (total_num_lines+1));
 	new_file        = g_malloc(sizeof(gchar) * (total_num_chars+1));
 	new_file[0]     = '\0';
 



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


More information about the Plugins-Commits mailing list