~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to debian/patches/bash42-044.diff

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
                             BASH PATCH REPORT
2
 
                             =================
3
 
 
4
 
Bash-Release:   4.2
5
 
Patch-ID:       bash42-044
6
 
 
7
 
Bug-Reported-by:        "Dashing" <dashing@hushmail.com>
8
 
Bug-Reference-ID:       <20130211175049.D90786F446@smtp.hushmail.com>
9
 
Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-bash/2013-02/msg00030.html
10
 
 
11
 
Bug-Description:
12
 
 
13
 
When converting a multibyte string to a wide character string as part of
14
 
pattern matching, bash does not handle the end of the string correctly,
15
 
causing the search for the NUL to go beyond the end of the string and
16
 
reference random memory.  Depending on the contents of that memory, bash
17
 
can produce errors or crash. 
18
 
 
19
 
Patch (apply with `patch -p0'):
20
 
 
21
 
Index: b/bash/lib/glob/xmbsrtowcs.c
22
 
===================================================================
23
 
--- a/bash/lib/glob/xmbsrtowcs.c
24
 
+++ b/bash/lib/glob/xmbsrtowcs.c
25
 
@@ -216,12 +216,24 @@
26
 
         It may set 'p' to NULL. */
27
 
       n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state);
28
 
 
29
 
+      if (n == 0 && p == 0)
30
 
+       {
31
 
+         wsbuf[wcnum] = L'\0';
32
 
+         break;
33
 
+       }
34
 
+
35
 
       /* Compensate for taking single byte on wcs conversion failure above. */
36
 
       if (wcslength == 1 && (n == 0 || n == (size_t)-1))
37
 
        {
38
 
          state = tmp_state;
39
 
          p = tmp_p;
40
 
-         wsbuf[wcnum++] = *p++;
41
 
+         wsbuf[wcnum] = *p;
42
 
+         if (*p == 0)
43
 
+           break;
44
 
+         else
45
 
+           {
46
 
+             wcnum++; p++;
47
 
+           }
48
 
        }
49
 
       else
50
 
         wcnum += wcslength;
51
 
Index: b/bash/patchlevel.h
52
 
===================================================================
53
 
--- a/bash/patchlevel.h
54
 
+++ b/bash/patchlevel.h
55
 
@@ -25,6 +25,6 @@
56
 
    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
57
 
    looks for to find the patch level (for the sccs version string). */
58
 
 
59
 
-#define PATCHLEVEL 43
60
 
+#define PATCHLEVEL 44
61
 
 
62
 
 #endif /* _PATCHLEVEL_H_ */