Article View: news.software.readers
Article #70403[slrn] file corrupting uudecode bug fixed
From: Sylvan Butler
Date: Thu, 11 Jan 2001 19:35
Date: Thu, 11 Jan 2001 19:35
72 lines
3147 bytes
3147 bytes
slrn 0.9.6.3 (and I believe other versions though I have not
specifically checked) may corrupt the file they are uudecoding.
slrn skips lines which contain a space. But since space is equivalent
to a backtick ('`') they need to be allowed.
Here is a patch that fixes the problem and still seems fairly robust
at ignoring extraneous (headers, sigs, etc) lines:
----------------------
--- slrn-0.9.6.3\src\uudecode.c Sun Sep 17 16:35:25 2000
+++ slrn-mine\src\uudecode.c Wed Jan 10 21:47:50 2001
@@ -1,4 +1,5 @@
/* -*- mode: C; mode: fold; -*- */
+/* vi: set ts=8 sts=3 noet : */
/*
This file is part of SLRN.
@@ -721,6 +722,7 @@
{
FILE *outfp = NULL;
char buf[MAX_ARTICLE_LINE_LEN];
+ int InUUE=0; /* 0==not in a uue, 1==between begin and end lines */
while (NULL != fgets (buf, sizeof (buf), fp))
{
@@ -747,6 +749,7 @@
if (NULL == (outfp = open_output_file (file, "uuencoded", mode, pipe_fp)))
return -1;
+ InUUE=1;
/* Now read parts of the file in. */
while (fgets (buf, sizeof(buf) - 1, fp) != NULL)
@@ -768,6 +771,7 @@
{
uudecode_fclose (outfp, pipe_fp);
outfp = NULL;
+ InUUE=0;
break;
}
}
@@ -794,6 +798,7 @@
if (NULL == (outfp = open_output_file (file, "uuencoded", mode, pipe_fp)))
return -1;
+ InUUE=1;
continue;
}
@@ -831,7 +836,8 @@
}
}
/* This may still be a bogus line, e.g., a header. */
- if (NULL != slrn_strchr (buf, ' '))
+ /* but some valid uuencodings have spaces! (' '=='`') */
+ if (0 == InUUE && NULL != slrn_strchr (buf, ' '))
continue;
b = (unsigned char *) buf + 1;
----------------------
There may be a better approach, but this does seem to work. Even when
decoding files that mix the backtick and space.
sdb
--
| Sylvan Butler | Not speaking for Hewlett-Packard | sbutler-boi.hp.com |
| Watch out for my e-mail address. Thank UCE. #### change ^ to @ #### |
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety. --Benjamin Franklin, 1759
"Don't Tread On Me!"
Technical Details
Message-ID:
<slrn95s2p2.31q.Znospam+noZs_0101@hpb13799Z.Zboi.hpZ.com.invalid>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!supernews.google.com!sn-xit-03!supernews.com!xfer13.netnews.com!netnews.com!newsfeed.wirehub.nl!telocity-west!TELOCITY!enews.sgi.com!sdd.hp.com!hp-corv.cv.hp.com!hpb10302.boi.hp.com!Znospam+noZs_0101Show Full Headers
Complete Article Headers
Message-ID: <slrn95s2p2.31q.Znospam+noZs_0101@hpb13799Z.Zboi.hpZ.com.invalid> Subject: [slrn] file corrupting uudecode bug fixed Date: Thu, 11 Jan 2001 19:35:38 +0000 From: Znospam+noZs_0101@hpb13799Z.Zboi.hpZ.com.invalid (Sylvan Butler) 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!supernews.google.com!sn-xit-03!supernews.com!xfer13.netnews.com!netnews.com!newsfeed.wirehub.nl!telocity-west!TELOCITY!enews.sgi.com!sdd.hp.com!hp-corv.cv.hp.com!hpb10302.boi.hp.com!Znospam+noZs_0101 Newsgroups: news.software.readers Organization: Hewlett-Packard Mail-Copies-To: never User-Agent: slrn/0.9.6.2 (Linux) NNTP-Posting-Host: hpb13799.boi.hp.com X-Trace: 11 Jan 2001 12:35:38 -0700, hpb13799.boi.hp.com Lines: 71