Your message dated Mon, 09 Mar 2009 13:47:09 +0000
with message-id <[email protected]>
and subject line Bug#508484: fixed in strace 4.5.18-1
has caused the Debian Bug report #508484,
regarding SIGSEGV in strace,due to off by one error in string_quote
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
508484: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508484
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: strace
Version: 4.5.17+cvs080723-2
Severity: important
Tags: patch
I have decided to notify you of the "off by one" BUG in string_quote.
This stuff seems to be fixed in CVS HEAD between revision 1.80 and 1.81
for util.c. For your convenience I have attached the patch as lifted
from CVS. Applying attached patch fixed the BUG for me for a debian
lenny system running on x86_64 arch (AMD64).
Regard,
Joachim Falk
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (520, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.18-openvz-028stab059.6 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages strace depends on:
ii libc6 2.7-16 GNU C Library: Shared libraries
strace recommends no packages.
strace suggests no packages.
-- no debconf information
2008-11-09 Dmitry V. Levin <[email protected]>
* util.c (string_quote): Fix support for NUL-terminated string.
Add comments.
(printpathn): Fix the case when "..." was appended to the output
but no truncation was actually made. Add comments.
(printstr): Fix memory allocation. Fix two cases when "..." was
appended to the output but no truncation was actually made.
Add comments.
--- util.c.orig 2008-07-19 15:08:55.000000000 +0200
+++ util.c 2008-12-08 18:46:21.000000000 +0100
@@ -407,6 +407,12 @@
static char path[MAXPATHLEN + 1];
+/*
+ * Quote string `instr' of length `size'
+ * Write up to (3 + `size' * 4) bytes to `outstr' buffer.
+ * If `len' < 0, treat `instr' as a NUL-terminated string
+ * and quote at most (`size' - 1) bytes.
+ */
static int
string_quote(const char *instr, char *outstr, int len, int size)
{
@@ -417,12 +423,18 @@
if (xflag > 1)
usehex = 1;
else if (xflag) {
+ /* Check for presence of symbol which require
+ to hex-quote the whole string. */
for (i = 0; i < size; ++i) {
c = ustr[i];
- if (len < 0 && i == size - 2 && c != '\0')
- ++i;
- if (len < 0 && c == '\0')
- break;
+ /* Check for NUL-terminated string. */
+ if (len < 0) {
+ if (c == '\0')
+ break;
+ /* Quote at most size - 1 bytes. */
+ if (i == size - 1)
+ continue;
+ }
if (!isprint(c) && !isspace(c)) {
usehex = 1;
break;
@@ -433,20 +445,31 @@
*s++ = '\"';
if (usehex) {
+ /* Hex-quote the whole string. */
for (i = 0; i < size; ++i) {
c = ustr[i];
- if (len < 0 && c == '\0')
- break;
+ /* Check for NUL-terminated string. */
+ if (len < 0) {
+ if (c == '\0')
+ break;
+ /* Quote at most size - 1 bytes. */
+ if (i == size - 1)
+ continue;
+ }
sprintf(s, "\\x%02x", c);
s += 4;
}
} else {
for (i = 0; i < size; ++i) {
c = ustr[i];
- if (len < 0 && i == size - 2 && c != '\0')
- ++i;
- if (len < 0 && c == '\0')
- break;
+ /* Check for NUL-terminated string. */
+ if (len < 0) {
+ if (c == '\0')
+ break;
+ /* Quote at most size - 1 bytes. */
+ if (i == size - 1)
+ continue;
+ }
switch (c) {
case '\"': case '\\':
*s++ = '\\';
@@ -495,18 +518,25 @@
return i == size;
}
+/*
+ * Print path string specified by address `addr' and length `n'.
+ * If path length exceeds `n', append `...' to the output.
+ */
void
printpathn(struct tcb *tcp, long addr, int n)
{
- if (n > sizeof path - 1)
- n = sizeof path - 1;
-
- if (addr == 0) {
+ if (!addr) {
tprintf("NULL");
return;
}
+ /* Cap path length to the path buffer size,
+ and NUL-terminate the buffer. */
+ if (n > sizeof path - 1)
+ n = sizeof path - 1;
path[n] = '\0';
+
+ /* Fetch one byte more to find out whether path length > n. */
if (umovestr(tcp, addr, n + 1, path) < 0)
tprintf("%#lx", addr);
else {
@@ -515,7 +545,8 @@
if (trunc)
path[n] = '\0';
- if (string_quote(path, outstr, -1, n + 1) || trunc)
+ (void) string_quote(path, outstr, -1, n + 1);
+ if (trunc)
strcat(outstr, "...");
tprintf("%s", outstr);
}
@@ -527,6 +558,11 @@
printpathn(tcp, addr, sizeof path - 1);
}
+/*
+ * Print string specified by address `addr' and length `len'.
+ * If `len' < 0, treat the string as a NUL-terminated string.
+ * If string length exceeds `max_strlen', append `...' to the output.
+ */
void
printstr(struct tcb *tcp, long addr, int len)
{
@@ -538,32 +574,39 @@
tprintf("NULL");
return;
}
- if (!str) {
- if ((str = malloc(max_strlen + 1)) == NULL
- || (outstr = malloc(4*max_strlen
- + sizeof "\"\"...")) == NULL) {
- fprintf(stderr, "out of memory\n");
- tprintf("%#lx", addr);
- return;
- }
+ /* Allocate static buffers if they are not allocated yet. */
+ if (!str)
+ str = malloc(max_strlen + 1);
+ if (!outstr)
+ outstr = malloc(4 * max_strlen + sizeof "\"...\"");
+ if (!str || !outstr) {
+ fprintf(stderr, "out of memory\n");
+ tprintf("%#lx", addr);
+ return;
}
if (len < 0) {
+ /*
+ * Treat as a NUL-terminated string: fetch one byte more
+ * because string_quote() quotes one byte less.
+ */
size = max_strlen + 1;
+ str[max_strlen] = '\0';
if (umovestr(tcp, addr, size, str) < 0) {
tprintf("%#lx", addr);
return;
}
}
else {
- size = MIN(len, max_strlen + 1);
+ size = MIN(len, max_strlen);
if (umoven(tcp, addr, size, str) < 0) {
tprintf("%#lx", addr);
return;
}
}
- if (string_quote(str, outstr, len, size))
+ if (string_quote(str, outstr, len, size) &&
+ (len < 0 || len > max_strlen))
strcat(outstr, "...");
tprintf("%s", outstr);
--- End Message ---
--- Begin Message ---
Source: strace
Source-Version: 4.5.18-1
We believe that the bug you reported is fixed in the latest version of
strace, which is due to be installed in the Debian FTP archive:
strace-udeb_4.5.18-1_amd64.udeb
to pool/main/s/strace/strace-udeb_4.5.18-1_amd64.udeb
strace_4.5.18-1.diff.gz
to pool/main/s/strace/strace_4.5.18-1.diff.gz
strace_4.5.18-1.dsc
to pool/main/s/strace/strace_4.5.18-1.dsc
strace_4.5.18-1_amd64.deb
to pool/main/s/strace/strace_4.5.18-1_amd64.deb
strace_4.5.18.orig.tar.gz
to pool/main/s/strace/strace_4.5.18.orig.tar.gz
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Frederik Schüler <[email protected]> (supplier of updated strace package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Mon, 09 Mar 2009 14:39:42 +0100
Source: strace
Binary: strace strace64 strace-udeb
Architecture: source amd64
Version: 4.5.18-1
Distribution: unstable
Urgency: low
Maintainer: Roland McGrath <[email protected]>
Changed-By: Frederik Schüler <[email protected]>
Description:
strace - A system call tracer
strace-udeb - A system call tracer (udeb)
strace64 - A system call tracer for 64bit binaries
Closes: 508484 515655 518852
Changes:
strace (4.5.18-1) unstable; urgency=low
.
* New upstream release, closes: #515655
+ Fix FTBFS, closes: #518852
* Backported patch from CVS: Fix support for NUL-terminated
string, closes: #508484
* Build-depend on debhelper (>= 7.0.0).
Checksums-Sha1:
392811798572e7f20d9adc8e1d43636be401c451 1265 strace_4.5.18-1.dsc
1ac2f25014a65043fe2c565813b92e7a28369d95 691990 strace_4.5.18.orig.tar.gz
60d2479562fcb3047af0f25de06b8f3c9c7d7855 2593 strace_4.5.18-1.diff.gz
5fb491d0d734ccd260c50441c35792fd040fb9fc 172654 strace_4.5.18-1_amd64.deb
fd1e4b25802e0cfdcb9b4d32045f515f5f8c4d91 95358 strace-udeb_4.5.18-1_amd64.udeb
Checksums-Sha256:
24999a62f39288a4989177c9f621f8296f0b4e6d4c0daa6a518b50531bd863bd 1265
strace_4.5.18-1.dsc
e809eab9b63e91e8e2fd23c5be4d9181f8306b2e2c0504212b9966997b6e4373 691990
strace_4.5.18.orig.tar.gz
9706e7dea8e8cb6b752fda4be6e30d301eaf5bac6282b04f5c4395274e1041c8 2593
strace_4.5.18-1.diff.gz
a090356c5b16b16230116cbeae4bd9ca57e4f60a9f2587470ed46bab33a16d3a 172654
strace_4.5.18-1_amd64.deb
458a2f0135f85ce7a5176c13438cece192c212139d273f7c288353ff07989998 95358
strace-udeb_4.5.18-1_amd64.udeb
Files:
26ff3a3c587446d77aed6b92b1642bd5 1265 utils standard strace_4.5.18-1.dsc
a98f390e01fab0613ad5986274ea5a6f 691990 utils standard
strace_4.5.18.orig.tar.gz
2ca71d57111622fbe684920229b4cfa7 2593 utils standard strace_4.5.18-1.diff.gz
2acabb4718e5b3d6603ec2042431907c 172654 utils standard
strace_4.5.18-1_amd64.deb
3f78605f452a45c84b00bb42db9206ce 95358 debian-installer extra
strace-udeb_4.5.18-1_amd64.udeb
Package-Type: udeb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkm1HIoACgkQ6n7So0GVSSDFswCgod6l6cBPrf0CFRUrOg+B+psr
tjAAoJ/F10LR1PEp9YeLcwb2T1MPQbX/
=lvPW
-----END PGP SIGNATURE-----
--- End Message ---