🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #63120

Re: [slrn] Bugfix: Soft linebreak on last line

#63120
From: Thomas Schultz
Date: Sun, 09 Jul 2000 00:00
61 lines
2524 bytes
On 09 July 2000 at 14:21 GMT, I wrote:
[Bugreport and patch]

As a reply to my previous posting, Dirk Nimmich pointed out that there
is another mistake in the way slrn handles quoted-printable messages.
RFC 2045, section 6.7 (3) clearly requires that all trailing unencoded
whitespace has to be stripped from a line before decoding it:

| Therefore, when decoding a Quoted-Printable body, any trailing white
| space on a line must be deleted, as it will necessarily have been
| added by intermediate transport agents.

I added a fix for this to the patch. Here is the new version:

diff -ur slrn-0.9.6.2.orig/src/mime.c slrn-0.9.6.2/src/mime.c
--- slrn-0.9.6.2.orig/src/mime.c	Sun Dec 19 22:51:32 1999
+++ slrn-0.9.6.2/src/mime.c	Sun Jul  9 20:02:42 2000
@@ -478,13 +478,15 @@
 static int merge_if_soft_linebreak (Slrn_Article_Line_Type *curr_line)
 {
    Slrn_Article_Line_Type *next_line;
+   unsigned int len;
 
    while ((next_line = curr_line->next) != NULL)
      {
 	char *b = curr_line->buf;
-	unsigned int len;
 
 	len = strlen (b);
+	while (len && isspace(b[len - 1]))
+	   b[--len] = '\0';
 	if (len == 0) return 0;
    
 	len--;
@@ -508,6 +510,12 @@
 	SLFREE (next_line->buf);
 	SLFREE (next_line);
      }
+   
+   /* In case the last line ends with a soft linebreak: */
+   len = strlen(curr_line->buf);
+   if (len && (curr_line->buf[len-1] == '='))
+     curr_line->buf[len-1] = '\0';
+   
    return 0;
 }
 
@@ -532,8 +540,9 @@
 	
 	b = line->buf;
 	len = strlen (b);
-	if (len && (b[len - 1] == '=') 
-	    && (line->next != NULL))
+	while (len && isspace(b[len - 1]))
+	   b[--len] = '\0';
+	if (len && (b[len - 1] == '='))
 	  {
 	     (void) merge_if_soft_linebreak (line);
 	     b = line->buf;

Technical Details
Message-ID: <slrn8mhgeg.46e.tststs@starflower.tststs.ddns.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <slrn8mh2jc.13g.tststs@starflower.tststs.ddns.org>

Show Full Headers
Complete Article Headers
Message-ID: <slrn8mhgeg.46e.tststs@starflower.tststs.ddns.org>
Subject: Re: [slrn] Bugfix: Soft linebreak on last line
Date: Sun, 09 Jul 2000 00:00:00 +0000
From: tststs@gmx.de (Thomas Schultz)
References: <slrn8mh2jc.13g.tststs@starflower.tststs.ddns.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 644311874
X-Server-Date: 9 Jul 2000 18:17:05 GMT
X-Complaints-To: abuse@cityweb.de
Organization: Pinguin online.
User-Agent: slrn/0.9.6.2+ (Linux)
NNTP-Posting-Date: 9 Jul 2000 18:19:12 GMT
Newsgroups: news.software.readers