Fresh pull from upstream (stable) package feed
[librecmc/package-feed.git] / libs / libxslt / patches / 0019-Fix-OOB-heap-read-in-xsltExtModuleRegisterDynamic.patch
1 From 87c3d9ea214fc0503fd8130b6dd97431d69cc066 Mon Sep 17 00:00:00 2001
2 From: Nick Wellnhofer <wellnhofer@aevum.de>
3 Date: Thu, 5 May 2016 15:12:48 +0200
4 Subject: [PATCH] Fix OOB heap read in xsltExtModuleRegisterDynamic
5
6 xsltExtModuleRegisterDynamic would read a byte before the start of a
7 string under certain circumstances. I looks like this piece code was
8 supposed to strip characters from the end of the extension name, but
9 it didn't have any effect. Don't read beyond the beginning of the
10 string and actually strip unwanted characters.
11
12 Found with afl-fuzz and ASan.
13 ---
14  libxslt/extensions.c | 5 ++++-
15  1 file changed, 4 insertions(+), 1 deletion(-)
16
17 diff --git a/libxslt/extensions.c b/libxslt/extensions.c
18 index 5ad73cb..ae6eef0 100644
19 --- a/libxslt/extensions.c
20 +++ b/libxslt/extensions.c
21 @@ -367,8 +367,11 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
22          i++;
23      }
24  
25 -    if (*(i - 1) == '_')
26 +    /* Strip underscores from end of string. */
27 +    while (i > ext_name && *(i - 1) == '_') {
28 +        i--;
29          *i = '\0';
30 +    }
31  
32      /* determine module directory */
33      ext_directory = (xmlChar *) getenv("LIBXSLT_PLUGINS_PATH");
34 -- 
35 2.8.1
36