Your message dated Tue, 23 Dec 2008 11:32:04 +0000
with message-id <[email protected]>
and subject line Bug#486630: fixed in trn 3.6-19
has caused the Debian Bug report #486630,
regarding trn: fails to trim References: lines correctly.
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.)
--
486630: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486630
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: trn
Version: 3.6-16
Severity: normal
Tags: patch
When presented with an overlong References: line trn copies it into a
fixed length buffer which often causes a reference to become
truncated.
e.g:
Message-ID: <[email protected]>
References: <[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
becomes:
References: <[email protected]> <[email protected]>
<xxxxxxxxx <[email protected]>
on reply.
I believe this patch fixes the bug without introducing any new ones:
diff -u old-trn/trn-3.6/intrp.c trn-3.6/intrp.c
--- old-trn/trn-3.6/intrp.c 1994-11-10 10:30:06.000000000 +0000
+++ trn-3.6/intrp.c 2008-06-17 12:09:10.000000000 +0100
@@ -868,8 +868,23 @@
if (in_ng) {
parseheader(art);
if (htype[REFS_LINE].ht_minpos >= 0) {
+ int trial_size=sizeof(scrbuf);
+ char * trial_buf=0;
+
refs_buf = fetchlines(art,REFS_LINE);
- refscpy(scrbuf,(sizeof scrbuf),refs_buf);
+ do {
+ if (trial_buf != 0) trial_size = trial_size*2;
+ free(trial_buf);
+ trial_buf = malloc(trial_size);
+ } while (refscpy(trial_buf,trial_size,refs_buf) <
1);
+ if (strlen(trial_buf)+1 < (sizeof scrbuf)) {
+ strcpy(scrbuf, trial_buf);
+ }
+ else {
+ reducerefs(scrbuf,(sizeof scrbuf),trial_buf);
+ }
+
+ free(trial_buf);
}
else
*scrbuf = '\0';
@@ -885,21 +900,18 @@
}
parseheader(art);
if (htype[REFS_LINE].ht_minpos >= 0) {
+ int trial_size=sizeof(scrbuf);
+ char * trial_buf=0;
+
refs_buf = fetchlines(art,REFS_LINE);
- refscpy(scrbuf,(sizeof scrbuf),refs_buf);
- /* no more than 3 prior references PLUS the
- ** root article allowed, including the one
- ** concatenated below */
- if ((s = rindex(scrbuf,'<')) > scrbuf) {
- *s = '\0';
- h = rindex(scrbuf,'<');
- *s = '<';
- if (h > scrbuf) {
- s = index(scrbuf+1,'<');
- if (s < h)
- strcpy(s,h);
- }
- }
+
+ do {
+ if (trial_buf != 0) trial_size = trial_size*2;
+ free(trial_buf);
+ trial_buf = malloc(trial_size);
+ } while (refscpy(trial_buf,trial_size,refs_buf) < 1);
+ reducerefs(scrbuf,(sizeof scrbuf),trial_buf);
+ free(trial_buf);
}
else
*scrbuf = '\0';
@@ -1247,7 +1259,7 @@
/* copy a references line, normalizing as we go */
-void
+int
refscpy(dest,destsize,src)
register char *dest, *src;
register int destsize;
@@ -1300,8 +1312,49 @@
*dest++ = ' ';
}
*dest = '\0';
+ return(destsize);
}
+/* reduce a references line */
+/* note, modifies src */
+void
+reducerefs(dest,destsize,src)
+register char *dest, *src;
+register int destsize;
+{
+ char * s;
+ char * h;
+ /* no more than 3 prior references PLUS the
+ ** root article allowed, including the one
+ ** concatenated below */
+ if ((s = rindex(src,'<')) > src) {
+ *s = '\0';
+ h = rindex(src,'<');
+ *s = '<';
+ if (h > src) {
+ s = index(src+1,'<');
+ if (s < h)
+ strcpy(s,h);
+ }
+ }
+ if (strlen(src) < destsize) {
+ strcpy(dest,src);
+ }
+ else {
+ if ((s = rindex(src,'<')) > src) {
+ if (strlen(s) < destsize) {
+ strcpy(dest,s);
+ }
+ else {
+ *dest = '\0';
+ }
+ }
+ else {
+ *dest = '\0';
+ }
+ }
+}
+
/* get the person's real name from /etc/passwd */
/* (string is overwritten, so it must be copied) */
diff -u old-trn/trn-3.6/intrp.h trn-3.6/intrp.h
--- old-trn/trn-3.6/intrp.h 1994-10-18 00:16:29.000000000 +0100
+++ trn-3.6/intrp.h 2008-06-17 11:49:57.000000000 +0100
@@ -33,5 +33,6 @@
char *filexp _((char*));
char *dointerp _((char*,int,char*,char*));
void interp _((char*,int,char*));
-void refscpy _((char*,int,char*));
+int refscpy _((char*,int,char*));
+void reducerefs _((char*,int,char*));
char *getrealname _((long));
-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.16.60
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages trn depends on:
ii inewsinn [inews] 1:1.7.2-19 NNTP client news injector, from In
ii libc6 2.3.2.ds1-22sarge6 GNU C Library: Shared libraries an
ii libncurses5 5.4-4 Shared libraries for terminal hand
-- no debconf information
--- End Message ---
--- Begin Message ---
Source: trn
Source-Version: 3.6-19
We believe that the bug you reported is fixed in the latest version of
trn, which is due to be installed in the Debian FTP archive:
trn_3.6-19.dsc
to pool/non-free/t/trn/trn_3.6-19.dsc
trn_3.6-19.tar.gz
to pool/non-free/t/trn/trn_3.6-19.tar.gz
trn_3.6-19_i386.deb
to pool/non-free/t/trn/trn_3.6-19_i386.deb
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.
Matthew Vernon <[email protected]> (supplier of updated trn 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.7
Date: Tue, 23 Dec 2008 11:20:54 +0000
Source: trn
Binary: trn
Architecture: source i386
Version: 3.6-19
Distribution: unstable
Urgency: low
Maintainer: Matthew Vernon <[email protected]>
Changed-By: Matthew Vernon <[email protected]>
Description:
trn - Threaded USENET news reader, based on rn
Closes: 142731 486630 503968 503971
Changes:
trn (3.6-19) unstable; urgency=low
.
* copyright file fixes: standardise to license; remove parsedate.c
copyright section, as this is regenerated at each build (closes: #142731)
* Apply (corrected) patch from Ben Harris to make editor the default
editor, in line with policy (closes: #503971)
* Apply patch from Ben Harris <[email protected]> to replace KILL files
more safely (closes: #503968)
* Apply patch from Jonathan Amery <[email protected]> to
make trn deal better with overlong References: lines (closes: #486630)
Files:
b8b3a8f679760ca9dcb6a67bdd56e8d8 605 non-free/news optional trn_3.6-19.dsc
c86664f24a328a20046fee11bef8d9df 353998 non-free/news optional
trn_3.6-19.tar.gz
019e4240b6f47b57e27de95381f585d3 214892 non-free/news optional
trn_3.6-19_i386.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iQCVAwUBSVDKjrDSad4X89TRAQKUBQQAj83dBtsnfPdTazyeLnf+ux2UHDZUbgMu
thOgZoc7NzdDTeUn/jeOkG9z80qeIOUjqXf1zA9j7h0V8S7efhYGtTObp9H2RbTW
x/0NfkFBGbmOB2IERDxvYG2yIoCnZz0r59lFWgoj7Ma6hWV6hSF7nK/n59vKNPDL
qIL4AgUXACc=
=ebQQ
-----END PGP SIGNATURE-----
--- End Message ---