From 2c906c99e3ca06b69ea681be981293f3c8706f24 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 26 Oct 2006 08:47:39 +0000 Subject: [PATCH] * Fix a buffer overflow in the import format autodetection code. --- cucul/import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cucul/import.c b/cucul/import.c index 2cc3330..8c64d7e 100644 --- a/cucul/import.c +++ b/cucul/import.c @@ -90,7 +90,7 @@ cucul_canvas_t * cucul_import_canvas(cucul_buffer_t *buffer, char const *format) return import_caca(buffer->data, buffer->size); /* If we find ESC[ argv, we guess it's an ANSI file */ - for(i = 0; i < buffer->size - 1; i++) + for(i = 0; i + 1 < buffer->size; i++) if((buf[i] == 0x1b) && (buf[i + 1] == '[')) return import_ansi(buffer->data, buffer->size, 0);