Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 17 Jan 2016 14:36:42 UTC Commit: ee354655993507b7b998a3c13e4417ea0b1286af https://github.com/geany/geany-plugins/commit/ee354655993507b7b998a3c13e4417...
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).