From 52ef3242e826957cd0b464b8211eb6a3f3b0480d Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Tue, 12 Aug 2003 15:27:02 +0000 Subject: [PATCH] Properly fix the a2ps crash within included gettext. Map pointers should be recalculated if realloc moves the memory block they used to point to. --- .../files/patch-intl-localealias.c | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/print/a2ps-letter/files/patch-intl-localealias.c b/print/a2ps-letter/files/patch-intl-localealias.c index 2d0279bf9751..074a19569ca5 100644 --- a/print/a2ps-letter/files/patch-intl-localealias.c +++ b/print/a2ps-letter/files/patch-intl-localealias.c @@ -1,19 +1,20 @@ ---- intl/localealias.c.orig Tue Aug 31 19:29:35 1999 -+++ intl/localealias.c Sun Jul 6 05:35:31 2003 -@@ -333,12 +333,12 @@ +--- intl/localealias.c.orig Tue Aug 31 13:29:35 1999 ++++ intl/localealias.c Tue Aug 12 11:09:53 2003 +@@ -329,6 +329,17 @@ + FREE_BLOCKS (block_list); + return added; + } ++ if (string_space != new_pool) ++ { ++ size_t i; ++ ++ for (i = 0; i < nmap; i++) ++ { ++ map[i].alias += new_pool - string_space; ++ map[i].value += new_pool - string_space; ++ } ++ } ++ + string_space = new_pool; string_space_max = new_size; } - -- map[nmap].alias = memcpy (&string_space[string_space_act], -- alias, alias_len); -+ memcpy (&string_space[string_space_act], alias, alias_len); -+ map[nmap].alias = &string_space[string_space_act]; - string_space_act += alias_len; - -- map[nmap].value = memcpy (&string_space[string_space_act], -- value, value_len); -+ memcpy (&string_space[string_space_act], value, value_len); -+ map[nmap].value = &string_space[string_space_act]; - string_space_act += value_len; - - ++nmap;