From eabad0bdfbb6e62261279e4a53682b2d28ffd678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Tue, 4 Dec 2012 11:09:45 +0100 Subject: [PATCH] Fix sv_cache init global-buffer-overflow (Reini Urban - RT#81469) Ported to 0.88. --- CSV_XS.xs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CSV_XS.xs b/CSV_XS.xs index 2d119af..89ec61a 100644 --- a/CSV_XS.xs +++ b/CSV_XS.xs @@ -201,6 +201,7 @@ xs_error_t xs_errors[] = { { 0, "" }, }; +static char init_cache[CACHE_SIZE]; static int io_handle_loaded = 0; static SV *m_getline, *m_print; @@ -529,9 +530,8 @@ static void cx_SetupCsv (pTHX_ csv_t *csv, HV *self, SV *pself) csv->verbatim = bool_opt ("verbatim"); csv->auto_diag = bool_opt ("auto_diag"); - sv_cache = newSVpvn ("", CACHE_SIZE); + sv_cache = newSVpvn (init_cache, CACHE_SIZE); csv->cache = (byte *)SvPVX (sv_cache); - memset (csv->cache, 0, CACHE_SIZE); SvREADONLY_on (sv_cache); csv->cache[CACHE_ID_quote_char] = csv->quote_char; -- 1.7.11.7