NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/54766: Broken mime-hooks handling in mail(1)



>Number:         54766
>Category:       bin
>Synopsis:       Broken mime-hooks handling in mail(1)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 14 20:20:00 +0000 2019
>Originator:     elo
>Release:        NetBSD 9.0_BETA
>Organization:
>Environment:
System: NetBSD marmite.localnet 9.0_BETA NetBSD 9.0_BETA (BLUEBELL) #3: Sun Nov 3 02:10:56 GMT 2019 elo@marmite.localnet:/usr/obj/sys/arch/amd64/compile/BLUEBELL amd64
Architecture: x86_64
Machine: amd64
>Description:
	The handling of mime hooks in the mail(1) client program
	was broken by revision 1.9, dated Thu, 9 Nov 2017, to the
	file 'src/usr.bin/mail/mime_child.c'. On that day, the 'f'
	modifier, permitting only regular files to be opened, was
	added to the mode string of calls to fopen(3) and fdopen(3)
	throughout the mail source. Unluckily, in two locations it
	was added to fdopen() calls that only ever operate on pipes,
	thereby ensuring that those calls, part of the mime-hooks
	handling code, would always fail.
>How-To-Repeat:
	Define a mime handler in the mail(1) configuration file.
	Something like this should suffice.

	set mime-body-text-html="+lynx -dump -force-html -stdin"

	Then try, and fail, to view an HTML e-mail message.
>Fix:
	Apply the following patch, which partly reverts revision 1.9.

--- a/usr/src/usr.bin/mail/mime_child.c	2019-12-14 18:11:24.005104242 +0000
+++ b/usr/src/usr.bin/mail/mime_child.c	2019-08-16 20:18:41.127522330 +0100
@@ -159,7 +159,7 @@
 	default:	/* parent */
 		(void)close(p[READ]);
 
-		nfo = fdopen(p[WRITE], "wef");
+		nfo = fdopen(p[WRITE], "we");
 		if (nfo == NULL) {
 			warn("mime_run_command: fdopen");
 			(void)close(p[WRITE]);
@@ -203,7 +203,7 @@
 
 	default:	/* parent */
 		(void)close(p[READ]);
-		nfo = fdopen(p[WRITE], "wef");
+		nfo = fdopen(p[WRITE], "we");
 		if (nfo == NULL) {
 			warn("run_function: fdopen");
 			(void)close(p[WRITE]);



Home | Main Index | Thread Index | Old Index