NetBSD-Bugs archive

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

bin/56548: mail(1) segfaults if thread commands are used in ~/.mailrc



>Number:         56548
>Category:       bin
>Synopsis:       mail(1) segfaults if thread commands are used in ~/.mailrc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 14 06:05:00 +0000 2021
>Originator:     RVP
>Release:        NetBSD/amd64 9.99.92
>Organization:
>Environment:
NetBSD x202e.localdomain 9.99.92 NetBSD 9.99.92 (MYKERNEL) #0: Mon Dec 13 03:43:43 UTC 2021  bld@x202e.localdomain:/usr/obj/usr/src/sys/arch/amd64/compile/MYKERNEL amd64
>Description:
Most of the thread-related commands (thread, sort, reverse, ...) cause a
segfault if they're included in ~/.mailrc:

$ echo "sort rdate" > newmailrc
$ mail -r newmailrc
Segmentation fault (core dumped)
$ 
>How-To-Repeat:
As above.
>Fix:
Make the `thread' commands interactive-only (however, commands like `sort'
or `reverse' seem useful if included in ~/.mailrc).

---START PATCH---
diff -urN a/src/usr.bin/mail/cmdtab.c b/src/usr.bin/mail/cmdtab.c
--- a/src/usr.bin/mail/cmdtab.c	2009-04-10 13:08:24.000000000 +0000
+++ b/src/usr.bin/mail/cmdtab.c	2021-12-13 22:10:21.827573957 +0000
@@ -152,32 +152,32 @@
 /* R */	{ "Detach",	Detach,		S, CMP(F)	STRLIST,	0,		0 },
 #endif
 #ifdef THREAD_SUPPORT
-	{ "flatten",	flattencmd,	0, CMP(n)	T|NDMLIST,	0,		MMNDEL },
-	{ "reverse",	reversecmd,	0, CMP(n)	T|STRLIST,	0,		0 },
-	{ "sort",	sortcmd,	0, CMP(T)	T|STRLIST,	0,		0 },
-	{ "thread",	threadcmd,	0, CMP(T)	T|STRLIST,	0,		0 },
-	{ "unthread",	unthreadcmd,	0, CMP(n)	T|STRLIST,	0,		0 },
+	{ "flatten",	flattencmd,	0, CMP(n)	I|T|NDMLIST,	0,		MMNDEL },
+	{ "reverse",	reversecmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
+	{ "sort",	sortcmd,	0, CMP(T)	I|T|STRLIST,	0,		0 },
+	{ "thread",	threadcmd,	0, CMP(T)	I|T|STRLIST,	0,		0 },
+	{ "unthread",	unthreadcmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
 
-	{ "down",	downcmd,	0, CMP(n)	T|MSGLIST,	0,		MMNDEL },
-	{ "tset",	tsetcmd,	0, CMP(n)	T|MSGLIST,	0,		MMNDEL },
-	{ "up",		upcmd,		0, CMP(n)	T|STRLIST,	0,		0 },
+	{ "down",	downcmd,	0, CMP(n)	I|T|MSGLIST,	0,		MMNDEL },
+	{ "tset",	tsetcmd,	0, CMP(n)	I|T|MSGLIST,	0,		MMNDEL },
+	{ "up",		upcmd,		0, CMP(n)	I|T|STRLIST,	0,		0 },
 
-	{ "expose",	exposecmd,	0, CMP(n)	T|STRLIST,	0,		0 },
-	{ "hide",	hidecmd,	0, CMP(n)	T|STRLIST,	0,		0 },
-	{ "showthreads",exposecmd,	0, CMP(n)	T|STRLIST,	0,		0 },
-	{ "hidethreads",hidecmd,	0, CMP(n)	T|STRLIST,	0,		0 },
+	{ "expose",	exposecmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
+	{ "hide",	hidecmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
+	{ "showthreads",exposecmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
+	{ "hidethreads",hidecmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
 #ifdef THREAD_DEBUG
-	{ "debug_links",thread_showcmd,	S, CMP(n)	T|MSGLIST,	0,		MMNDEL },
+	{ "debug_links",thread_showcmd,	S, CMP(n)	I|T|MSGLIST,	0,		MMNDEL },
 #endif
-/* R */	{ "tag",	tagcmd,		0, CMP(n)	T|MSGLIST,	0,		MMNDEL },
-/* R */	{ "untag",	untagcmd,	0, CMP(n)	T|MSGLIST,	0,		MMNDEL },
-/* R */	{ "invtags",	invtagscmd,	0, CMP(n)	T|MSGLIST,	0,	 	MMNDEL },
-	{ "tagbelow",	tagbelowcmd,	0, CMP(n)	T|MSGLIST,	0,		MMNDEL },
+/* R */	{ "tag",	tagcmd,		0, CMP(n)	I|T|MSGLIST,	0,		MMNDEL },
+/* R */	{ "untag",	untagcmd,	0, CMP(n)	I|T|MSGLIST,	0,		MMNDEL },
+/* R */	{ "invtags",	invtagscmd,	0, CMP(n)	I|T|MSGLIST,	0,	 	MMNDEL },
+	{ "tagbelow",	tagbelowcmd,	0, CMP(n)	I|T|MSGLIST,	0,		MMNDEL },
 
-	{ "hidetags",	hidetagscmd,	0, CMP(n)	T|STRLIST,	0,		0 },
-	{ "showtags",	showtagscmd,	0, CMP(n)	T|STRLIST,	0,		0 },
+	{ "hidetags",	hidetagscmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
+	{ "showtags",	showtagscmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
 
-	{ "deldups",	deldupscmd,	0, CMP(n)	T|STRLIST,	0,		0 },
+	{ "deldups",	deldupscmd,	0, CMP(n)	I|T|STRLIST,	0,		0 },
 #endif /* THREAD_SUPPORT */
 	{ 0,		0,		0, CMP0		0,		0,		0 }
 };
---END PATCH---



Home | Main Index | Thread Index | Old Index