From e8af86017a4b072a9b03d914e34c24e387dac3f3 Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Tue, 7 Feb 2012 21:37:53 +0530 Subject: [PATCH] Fixed a bug caused while highlighting double quoted strings. For e.g. ls "abc" shows up as invalid write for color of closing quote in valgrind. --- reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader.cpp b/reader.cpp index 617f1543f..9681aba5f 100644 --- a/reader.cpp +++ b/reader.cpp @@ -2443,7 +2443,7 @@ static void reader_super_highlight_me_plenty( int match_highlight_pos, array_lis { reader_sanity_check(); - int *color = (int *)calloc(data->buff_count, sizeof *color); + int *color = (int *)calloc(data->buff_count + 1, sizeof *color); background_highlight_context_t *ctx = new background_highlight_context_t(data->command_line, color, match_highlight_pos, data->highlight_function); #if 1 iothread_perform(threaded_highlight, highlight_complete, ctx);