Hi,

the attached patches fix the valgrind issue and now my bug seems to be
gone too.

Have you managed to upstream the format string fixes btw? I'd really
like to see upstream git repository but last time I couldn't find it.

There's at least one remaining valgrind issue:

==31166== Source and destination overlap in strcpy(0x7fefffea2, 0x7fefffea4)
==31166==    at 0x4C2CA05: __GI_strcpy (mc_replace_strmem.c:439)
==31166==    by 0x479DB3: pages_to_size (tools.c:5312)
==31166==    by 0x4A80C4: get_memory_size (memory.c:11888)
==31166==    by 0x4FC1C1: display_sys_stats (kernel.c:4706)
==31166==    by 0x463A64: main_loop (main.c:678)
==31166==    by 0x74CEC2: current_interp_command_loop (interps.c:326)
==31166==    by 0x74E171: captured_command_loop (main.c:258)
==31166==    by 0x74BB5F: catch_errors (exceptions.c:557)
==31166==    by 0x74F793: captured_main (main.c:1064)
==31166==    by 0x74BB5F: catch_errors (exceptions.c:557)
==31166==    by 0x74F7E1: gdb_main (main.c:1079)
==31166==    by 0x74F839: gdb_main_entry (main.c:1099)
==31166== 

If you look at the code it is obvious that strcpy is called with
overlapping arguments.

-Timo

>From ddf40d625a7bd8771e7009d22f4b2ab1d8458589 Mon Sep 17 00:00:00 2001
From: Timo Juhani Lindfors <timo.lindf...@iki.fi>
Date: Wed, 24 Jul 2013 09:37:10 +0300
Subject: [PATCH 1/3] add patch

---
 debian/patches/bug-717036.patch | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 debian/patches/bug-717036.patch

diff --git a/debian/patches/bug-717036.patch b/debian/patches/bug-717036.patch
new file mode 100644
index 0000000..977a53d
--- /dev/null
+++ b/debian/patches/bug-717036.patch
@@ -0,0 +1,38 @@
+--- a/kernel.c
++++ b/kernel.c
+@@ -218,21 +218,29 @@
+ 
+ 	strncpy(buf, kt->utsname.release, MIN(strlen(kt->utsname.release), 65));
+ 	if (ascii_string(kt->utsname.release)) {
++		char separator;
++
+ 		p1 = p2 = buf;
+ 		while (*p2 != '.')
+ 			p2++;
+ 		*p2 = NULLCHAR;
+ 		kt->kernel_version[0] = atoi(p1);
+ 		p1 = ++p2;
+-		while (*p2 != '.')
++		while (*p2 != '.' && *p2 != '-' && *p2 != '\0')
+ 			p2++;
++		separator = *p2;
+ 		*p2 = NULLCHAR;
+ 		kt->kernel_version[1] = atoi(p1);
+-		p1 = ++p2;
+-		while ((*p2 >= '0') && (*p2 <= '9'))
+-			p2++;
+-		*p2 = NULLCHAR;
+-		kt->kernel_version[2] = atoi(p1);
++		*p2 = separator;
++		if (*p2 == '.') {
++			p1 = ++p2;
++			while ((*p2 >= '0') && (*p2 <= '9'))
++				p2++;
++			*p2 = NULLCHAR;
++			kt->kernel_version[2] = atoi(p1);
++		} else {
++			kt->kernel_version[2] = 0;
++		}
+ 
+ 		if (CRASHDEBUG(1))
+ 			fprintf(fp, "base kernel version: %d.%d.%d\n",
-- 
1.8.3.2

>From 5f1c1ed408fc06bdaef9889743e76ff264bcc911 Mon Sep 17 00:00:00 2001
From: Timo Juhani Lindfors <timo.lindf...@iki.fi>
Date: Wed, 24 Jul 2013 09:37:16 +0300
Subject: [PATCH 2/3] update series

---
 debian/patches/series | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/patches/series b/debian/patches/series
index b543023..b7091c7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 01-format-strings.patch
 02-format-strings_additional.patch
+bug-717036.patch
-- 
1.8.3.2

>From d27e89e9c9109a1b214a2d068e5f63908dcdb9df Mon Sep 17 00:00:00 2001
From: Timo Juhani Lindfors <timo.lindf...@iki.fi>
Date: Wed, 24 Jul 2013 09:37:21 +0300
Subject: [PATCH 3/3] update changelog

---
 debian/changelog | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index e1b3d6b..b3c25ea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+crash (7.0.1-3lindi1) UNRELEASED; urgency=low
+
+  * Add patch to cope with kernel version numbers that only have two
+    parts (e.g. "3.8"):
+    - bug-717036.patch
+
+ -- Timo Juhani Lindfors <timo.lindf...@iki.fi>  Wed, 24 Jul 2013 09:33:08 +0300
+
 crash (7.0.1-3) unstable; urgency=low
 
   * Updated format-strings patch to cover additional architectures
-- 
1.8.3.2

Reply via email to