~ubuntu-branches/ubuntu/wily/makedumpfile/wily

« back to all changes in this revision

Viewing changes to debian/patches/upstream/4a16bd-fix-buffer-overflow-when-writing-dh-signature.patch

  • Committer: Bazaar Package Importer
  • Author(s): John Wright
  • Date: 2011-04-26 20:05:16 UTC
  • mfrom: (1.1.4 upstream) (7.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110426200516-7dzi6nnzouzfto2f
* Cherry-pick upstream commits:
  - [PATCH] BUGFIX: Avoid SIGSEGV when specifying -V option.
    (5b8c2da75cbdb230019a3b956793fb768055b977)
  - [PATCH] Copy correct nr_cpus info to dumpfile during re-filtering.
    (c4f1c98a9827c1c0e41772c1954940fbf1b48048)
* kdump-tools.init: Don't exit with failure status except for bad
  usage.  This way, even if /etc/default/kdump-tools has USE_KDUMP=1
  but the kernel command line or debug kernels are not set up,
  installation of a new version of the package will not leave it
  unconfigured.  (Closes: #623470)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
commit 4a16bd39866093f4949f8e9dc183fa2321bda22d
2
 
Author: Bernhard Walle <bernhard@bwalle.de>
3
 
Date:   Mon Feb 22 08:56:33 2010 +0900
4
 
 
5
 
    [PATCH] Fix buffer overflow when writing dh->signature.
6
 
    
7
 
    Fix following compile warning when building with gcc 4.5 and with the
8
 
    flags '-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
9
 
    -fasynchronous-unwind-tables -g -O2 -Wall'.
10
 
    
11
 
      In function 'strcpy',
12
 
          inlined from 'write_kdump_header' at makedumpfile.c:5457:8: \
13
 
          /usr/include/bits/string3.h:107:3: warning: call to \
14
 
          __builtin___strcpy_chk will always overflow destination buffer
15
 
    
16
 
    Solution: Don't copy the terminating zero byte.
17
 
    
18
 
    Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
19
 
 
20
 
diff --git a/makedumpfile.c b/makedumpfile.c
21
 
index 4fa6f50..855c718 100644
22
 
--- a/makedumpfile.c
23
 
+++ b/makedumpfile.c
24
 
@@ -5454,7 +5454,7 @@ write_kdump_header(void)
25
 
        /*
26
 
         * Write common header
27
 
         */
28
 
-       strcpy(dh->signature, KDUMP_SIGNATURE);
29
 
+       strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE));
30
 
        dh->header_version = 3;
31
 
        dh->block_size     = info->page_size;
32
 
        dh->sub_hdr_size   = sizeof(kh) + info->size_vmcoreinfo;