CVS commit: src/usr.bin/mail

2023-09-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Fri Sep  8 20:46:45 UTC 2023

Modified Files:
src/usr.bin/mail: support.c

Log Message:
Add check for space presence after comma in skin()

Check if comma is followed by space, otherwise it may lead to overflow in the
output buffer as space might be extra appended to the output buffer without
consuming anything from the input. This condition breaks the assumption that
length(input) >= length(output) while the code relies on it.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/mail/support.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2023-09-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Fri Sep  8 20:46:45 UTC 2023

Modified Files:
src/usr.bin/mail: support.c

Log Message:
Add check for space presence after comma in skin()

Check if comma is followed by space, otherwise it may lead to overflow in the
output buffer as space might be extra appended to the output buffer without
consuming anything from the input. This condition breaks the assumption that
length(input) >= length(output) while the code relies on it.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/mail/support.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/support.c
diff -u src/usr.bin/mail/support.c:1.26 src/usr.bin/mail/support.c:1.27
--- src/usr.bin/mail/support.c:1.26	Fri Sep  8 20:37:07 2023
+++ src/usr.bin/mail/support.c	Fri Sep  8 20:46:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: support.c,v 1.26 2023/09/08 20:37:07 shm Exp $	*/
+/*	$NetBSD: support.c,v 1.27 2023/09/08 20:46:45 shm Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)aux.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: support.c,v 1.26 2023/09/08 20:37:07 shm Exp $");
+__RCSID("$NetBSD: support.c,v 1.27 2023/09/08 20:46:45 shm Exp $");
 #endif
 #endif /* not lint */
 
@@ -537,7 +537,7 @@ skin(char *name)
 *cp2++ = ' ';
 			}
 			*cp2++ = c;
-			if (c == ',' && !gotlt) {
+			if (c == ',' && *cp == ' ' && !gotlt) {
 *cp2++ = ' ';
 for (/*EMPTY*/; *cp == ' '; cp++)
 	continue;



CVS commit: src/usr.bin/mail

2023-09-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Fri Sep  8 20:37:07 UTC 2023

Modified Files:
src/usr.bin/mail: support.c

Log Message:
Fix writing outside of the nbuf buffer in skin()

Data provided to skin() can be longer than LINEBUF (if same header is provided
multiple times, hfield returns concatenated data).

Thanks to riastradh@ for the review and comments


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mail/support.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/support.c
diff -u src/usr.bin/mail/support.c:1.25 src/usr.bin/mail/support.c:1.26
--- src/usr.bin/mail/support.c:1.25	Thu Nov  9 20:27:50 2017
+++ src/usr.bin/mail/support.c	Fri Sep  8 20:37:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: support.c,v 1.25 2017/11/09 20:27:50 christos Exp $	*/
+/*	$NetBSD: support.c,v 1.26 2023/09/08 20:37:07 shm Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)aux.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: support.c,v 1.25 2017/11/09 20:27:50 christos Exp $");
+__RCSID("$NetBSD: support.c,v 1.26 2023/09/08 20:37:07 shm Exp $");
 #endif
 #endif /* not lint */
 
@@ -456,13 +456,15 @@ skin(char *name)
 	char *cp, *cp2;
 	char *bufend;
 	int gotlt, lastsp;
-	char nbuf[LINESIZE];
+	char *nbuf, *ret;
 
 	if (name == NULL)
 		return NULL;
 	if (strchr(name, '(') == NULL && strchr(name, '<') == NULL
 	&& strchr(name, ' ') == NULL)
 		return name;
+
+	nbuf = emalloc(strlen(name) + 1); 
 	gotlt = 0;
 	lastsp = 0;
 	bufend = nbuf;
@@ -545,8 +547,11 @@ skin(char *name)
 		}
 	}
 	*cp2 = 0;
+	
+	ret = savestr(nbuf);
+	free(nbuf);
 
-	return savestr(nbuf);
+	return ret;
 }
 
 /*



CVS commit: src/usr.bin/mail

2023-09-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Fri Sep  8 20:37:07 UTC 2023

Modified Files:
src/usr.bin/mail: support.c

Log Message:
Fix writing outside of the nbuf buffer in skin()

Data provided to skin() can be longer than LINEBUF (if same header is provided
multiple times, hfield returns concatenated data).

Thanks to riastradh@ for the review and comments


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mail/support.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2023-09-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Fri Sep  8 14:34:02 UTC 2023

Modified Files:
src/usr.bin/mail: format.c

Log Message:
Fix check_bufsize() incorrect behaviour

The function ensures that that buffer is large enough to store the data (if
not, it reallocates it). It doubled the buffer every time the buffer was too
small, but in some cases it wasn't enough, which might lead to heap overflows.
Rewrite of this function handles int overflow scenarios as well as ensures the
buffer is big enough to handle the data.

Thanks riastradh@ for the review and comments


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mail/format.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/format.c
diff -u src/usr.bin/mail/format.c:1.17 src/usr.bin/mail/format.c:1.18
--- src/usr.bin/mail/format.c:1.17	Sun Aug  7 10:12:19 2022
+++ src/usr.bin/mail/format.c	Fri Sep  8 14:34:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: format.c,v 1.17 2022/08/07 10:12:19 andvar Exp $	*/
+/*	$NetBSD: format.c,v 1.18 2023/09/08 14:34:02 shm Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef __lint__
-__RCSID("$NetBSD: format.c,v 1.17 2022/08/07 10:12:19 andvar Exp $");
+__RCSID("$NetBSD: format.c,v 1.18 2023/09/08 14:34:02 shm Exp $");
 #endif /* not __lint__ */
 
 #include 
@@ -54,13 +54,21 @@ __RCSID("$NetBSD: format.c,v 1.17 2022/0
 static void
 check_bufsize(char **buf, size_t *bufsize, char **p, size_t cnt)
 {
-	char *q;
-	if (*p + cnt < *buf + *bufsize)
+	size_t offset = (size_t)(*p - *buf);
+
+	/* enough buffer allocated already */
+	if (cnt < *bufsize - offset)
 		return;
-	*bufsize *= 2;
-	q = erealloc(*buf, *bufsize);
-	*p = q + (*p - *buf);
-	*buf = q;
+
+	/* expand buffer till it's sufficient to handle the data */
+	while (cnt >= *bufsize - offset) {
+		if (*bufsize > SIZE_MAX/2)
+			errx(1, "out of memory");
+		*bufsize *= 2;
+	}
+
+	*buf = erealloc(*buf, *bufsize);
+	*p = *buf + offset;
 }
 
 static const char *



CVS commit: src/usr.bin/mail

2023-09-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Fri Sep  8 14:34:02 UTC 2023

Modified Files:
src/usr.bin/mail: format.c

Log Message:
Fix check_bufsize() incorrect behaviour

The function ensures that that buffer is large enough to store the data (if
not, it reallocates it). It doubled the buffer every time the buffer was too
small, but in some cases it wasn't enough, which might lead to heap overflows.
Rewrite of this function handles int overflow scenarios as well as ensures the
buffer is big enough to handle the data.

Thanks riastradh@ for the review and comments


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mail/format.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2023-09-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Fri Sep  8 14:22:04 UTC 2023

Modified Files:
src/usr.bin/mail: vars.c

Log Message:
Fixed undefined behaviour in hash()

Shift left on large int values was causing an undefined behaviour, fix it by
operating on unsigned int type instead. This patch changes behaviour of the
hash() slightly - if the computed hash is INT_MIN, the function previously
returned 0, but this case is negligible.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/mail/vars.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/vars.c
diff -u src/usr.bin/mail/vars.c:1.18 src/usr.bin/mail/vars.c:1.19
--- src/usr.bin/mail/vars.c:1.18	Sat Oct 27 15:14:51 2007
+++ src/usr.bin/mail/vars.c	Fri Sep  8 14:22:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vars.c,v 1.18 2007/10/27 15:14:51 christos Exp $	*/
+/*	$NetBSD: vars.c,v 1.19 2023/09/08 14:22:04 shm Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)vars.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: vars.c,v 1.18 2007/10/27 15:14:51 christos Exp $");
+__RCSID("$NetBSD: vars.c,v 1.19 2023/09/08 14:22:04 shm Exp $");
 #endif
 #endif /* not lint */
 
@@ -86,14 +86,12 @@ vcopy(const char str[])
 PUBLIC int
 hash(const char *name)
 {
-	int h = 0;
+	unsigned int h = 0;
 
 	while (*name) {
 		h <<= 2;
 		h += *name++;
 	}
-	if (h < 0 && (h = -h) < 0)
-		h = 0;
 	return h % HSHSIZE;
 }
 



CVS commit: src/usr.bin/mail

2023-09-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Fri Sep  8 14:22:04 UTC 2023

Modified Files:
src/usr.bin/mail: vars.c

Log Message:
Fixed undefined behaviour in hash()

Shift left on large int values was causing an undefined behaviour, fix it by
operating on unsigned int type instead. This patch changes behaviour of the
hash() slightly - if the computed hash is INT_MIN, the function previously
returned 0, but this case is negligible.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/mail/vars.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2023-08-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 23 03:49:00 UTC 2023

Modified Files:
src/usr.bin/mail: fio.c thread.c

Log Message:
mail: Fix regression for recent use-after-free fix

For makemessage(), do not skip thread_fix_old_links() for
newly-allocated message as before.

Thanks jun@ for report.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/mail/fio.c
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mail/thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/fio.c
diff -u src/usr.bin/mail/fio.c:1.44 src/usr.bin/mail/fio.c:1.45
--- src/usr.bin/mail/fio.c:1.44	Thu Aug 10 20:36:28 2023
+++ src/usr.bin/mail/fio.c	Wed Aug 23 03:49:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fio.c,v 1.44 2023/08/10 20:36:28 mrg Exp $	*/
+/*	$NetBSD: fio.c,v 1.45 2023/08/23 03:49:00 rin Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)fio.c	8.2 (Berkeley) 4/20/95";
 #else
-__RCSID("$NetBSD: fio.c,v 1.44 2023/08/10 20:36:28 mrg Exp $");
+__RCSID("$NetBSD: fio.c,v 1.45 2023/08/23 03:49:00 rin Exp $");
 #endif
 #endif /* not lint */
 
@@ -126,6 +126,7 @@ makemessage(FILE *f, int omsgCount, int 
 	struct message *omessage;	/* old message structure array */
 	struct message *nmessage;
 	ptrdiff_t off;
+	int need_init;
 
 	omessage = get_abs_message(1);
 
@@ -135,13 +136,15 @@ makemessage(FILE *f, int omsgCount, int 
 		off = 0;
 	else
 		off = dot - omessage;
+	need_init = (omessage == NULL);
 	nmessage = realloc(omessage, size);
 	if (nmessage == NULL)
 		err(EXIT_FAILURE,
 		"Insufficient memory for %d messages", nmsgCount);
 	dot = nmessage + off;
 
-	thread_fix_old_links(nmessage, off, omsgCount);
+	if (off != 0 || need_init != 0)
+		thread_fix_old_links(nmessage, off, omsgCount);
 
 #ifndef THREAD_SUPPORT
 	message = nmessage;

Index: src/usr.bin/mail/thread.c
diff -u src/usr.bin/mail/thread.c:1.15 src/usr.bin/mail/thread.c:1.16
--- src/usr.bin/mail/thread.c:1.15	Thu Aug 10 20:36:28 2023
+++ src/usr.bin/mail/thread.c	Wed Aug 23 03:49:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: thread.c,v 1.15 2023/08/10 20:36:28 mrg Exp $	*/
+/*	$NetBSD: thread.c,v 1.16 2023/08/23 03:49:00 rin Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef __lint__
-__RCSID("$NetBSD: thread.c,v 1.15 2023/08/10 20:36:28 mrg Exp $");
+__RCSID("$NetBSD: thread.c,v 1.16 2023/08/23 03:49:00 rin Exp $");
 #endif /* not __lint__ */
 
 #include 
@@ -443,8 +443,6 @@ PUBLIC void
 thread_fix_old_links(struct message *nmessage, ptrdiff_t off, int omsgCount)
 {
 	int i;
-	if (off == 0)
-		return;
 
 #ifndef NDEBUG
 	message_array.t_head = nmessage; /* for assert check in thread_fix_new_links */



CVS commit: src/usr.bin/mail

2023-08-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 23 03:49:00 UTC 2023

Modified Files:
src/usr.bin/mail: fio.c thread.c

Log Message:
mail: Fix regression for recent use-after-free fix

For makemessage(), do not skip thread_fix_old_links() for
newly-allocated message as before.

Thanks jun@ for report.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/mail/fio.c
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mail/thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2023-08-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug 11 07:01:01 UTC 2023

Modified Files:
src/usr.bin/mail: lex.c

Log Message:
explicitly truncate display name string size.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/mail/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/lex.c
diff -u src/usr.bin/mail/lex.c:1.45 src/usr.bin/mail/lex.c:1.46
--- src/usr.bin/mail/lex.c:1.45	Sun Feb  4 09:01:12 2018
+++ src/usr.bin/mail/lex.c	Fri Aug 11 07:01:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.45 2018/02/04 09:01:12 mrg Exp $	*/
+/*	$NetBSD: lex.c,v 1.46 2023/08/11 07:01:01 mrg Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.2 (Berkeley) 4/20/95";
 #else
-__RCSID("$NetBSD: lex.c,v 1.45 2018/02/04 09:01:12 mrg Exp $");
+__RCSID("$NetBSD: lex.c,v 1.46 2023/08/11 07:01:01 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -167,7 +167,8 @@ update_mailname(const char *name)
 sep = "...";
 			}
 			(void)snprintf(displayname, sizeof(displayname),
-			"+%s%s", sep, cp);
+			"+%s%.*s", sep,
+			(int)(sizeof(displayname) - 1 - strlen(sep)), cp);
 			return;
 		}
 	}



CVS commit: src/usr.bin/mail

2023-08-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug 11 07:01:01 UTC 2023

Modified Files:
src/usr.bin/mail: lex.c

Log Message:
explicitly truncate display name string size.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/mail/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2021-12-17 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Dec 17 15:29:44 UTC 2021

Modified Files:
src/usr.bin/mail: thread.c

Log Message:
Remove an unnecessary test for NULL (the same thing is done in the
following lines) along with an incorrect return of nothing if it is
found (the following version correctly returns NULL).   Should unbreak build.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/mail/thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/thread.c
diff -u src/usr.bin/mail/thread.c:1.13 src/usr.bin/mail/thread.c:1.14
--- src/usr.bin/mail/thread.c:1.13	Fri Dec 17 13:14:54 2021
+++ src/usr.bin/mail/thread.c	Fri Dec 17 15:29:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: thread.c,v 1.13 2021/12/17 13:14:54 christos Exp $	*/
+/*	$NetBSD: thread.c,v 1.14 2021/12/17 15:29:44 kre Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef __lint__
-__RCSID("$NetBSD: thread.c,v 1.13 2021/12/17 13:14:54 christos Exp $");
+__RCSID("$NetBSD: thread.c,v 1.14 2021/12/17 15:29:44 kre Exp $");
 #endif /* not __lint__ */
 
 #include 
@@ -594,8 +594,6 @@ first_visible_message(struct message *mp
 
 	if (mp == NULL)
 		mp = current_thread.t_head;
-	if (mp == NULL)
-		return;
 
 	if (mp == NULL)
 		return NULL;



CVS commit: src/usr.bin/mail

2021-12-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 17 13:14:54 UTC 2021

Modified Files:
src/usr.bin/mail: thread.c

Log Message:
more protection from unset threads from RVP


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mail/thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/thread.c
diff -u src/usr.bin/mail/thread.c:1.12 src/usr.bin/mail/thread.c:1.13
--- src/usr.bin/mail/thread.c:1.12	Tue Dec 14 16:12:03 2021
+++ src/usr.bin/mail/thread.c	Fri Dec 17 08:14:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: thread.c,v 1.12 2021/12/14 21:12:03 christos Exp $	*/
+/*	$NetBSD: thread.c,v 1.13 2021/12/17 13:14:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef __lint__
-__RCSID("$NetBSD: thread.c,v 1.12 2021/12/14 21:12:03 christos Exp $");
+__RCSID("$NetBSD: thread.c,v 1.13 2021/12/17 13:14:54 christos Exp $");
 #endif /* not __lint__ */
 
 #include 
@@ -594,6 +594,8 @@ first_visible_message(struct message *mp
 
 	if (mp == NULL)
 		mp = current_thread.t_head;
+	if (mp == NULL)
+		return;
 
 	if (mp == NULL)
 		return NULL;
@@ -827,6 +829,9 @@ thread_array(struct key_sort_s *marray, 
 {
 	struct message *parent;
 
+	if (mcount == 0)
+		return;
+
 	parent = marray[0].mp->m_plink;
 	qsort(marray, mcount, sizeof(*marray), qsort_cmpfn);
 	link_array(marray, mcount);



CVS commit: src/usr.bin/mail

2021-12-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 17 13:14:54 UTC 2021

Modified Files:
src/usr.bin/mail: thread.c

Log Message:
more protection from unset threads from RVP


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mail/thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2021-12-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 14 21:12:03 UTC 2021

Modified Files:
src/usr.bin/mail: thread.c

Log Message:
Avoid NULL deref if there is no current thread. From RVP.
Prints "No applicable message"


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mail/thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/thread.c
diff -u src/usr.bin/mail/thread.c:1.11 src/usr.bin/mail/thread.c:1.12
--- src/usr.bin/mail/thread.c:1.11	Fri Sep 10 17:52:18 2021
+++ src/usr.bin/mail/thread.c	Tue Dec 14 16:12:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: thread.c,v 1.11 2021/09/10 21:52:18 rillig Exp $	*/
+/*	$NetBSD: thread.c,v 1.12 2021/12/14 21:12:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef __lint__
-__RCSID("$NetBSD: thread.c,v 1.11 2021/09/10 21:52:18 rillig Exp $");
+__RCSID("$NetBSD: thread.c,v 1.12 2021/12/14 21:12:03 christos Exp $");
 #endif /* not __lint__ */
 
 #include 
@@ -595,6 +595,9 @@ first_visible_message(struct message *mp
 	if (mp == NULL)
 		mp = current_thread.t_head;
 
+	if (mp == NULL)
+		return NULL;
+
 	oldmp = mp;
 	if ((S_IS_RESTRICT(state) && is_tagged(mp)) || mp->m_flag & MDELETED)
 		mp = next_message(mp);



CVS commit: src/usr.bin/mail

2021-12-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 14 21:12:03 UTC 2021

Modified Files:
src/usr.bin/mail: thread.c

Log Message:
Avoid NULL deref if there is no current thread. From RVP.
Prints "No applicable message"


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mail/thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2021-12-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 14 15:13:42 UTC 2021

Modified Files:
src/usr.bin/mail: cmdtab.c

Log Message:
PR/56548: RVP: mail(1) segfaults if thread commands are used in ~/.mailrc


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/mail/cmdtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/cmdtab.c
diff -u src/usr.bin/mail/cmdtab.c:1.21 src/usr.bin/mail/cmdtab.c:1.22
--- src/usr.bin/mail/cmdtab.c:1.21	Fri Apr 10 09:08:24 2009
+++ src/usr.bin/mail/cmdtab.c	Tue Dec 14 10:13:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmdtab.c,v 1.21 2009/04/10 13:08:24 christos Exp $	*/
+/*	$NetBSD: cmdtab.c,v 1.22 2021/12/14 15:13:41 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)cmdtab.c	8.2 (Berkeley) 4/20/95";
 #else
-__RCSID("$NetBSD: cmdtab.c,v 1.21 2009/04/10 13:08:24 christos Exp $");
+__RCSID("$NetBSD: cmdtab.c,v 1.22 2021/12/14 15:13:41 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -152,32 +152,32 @@ const struct cmd cmdtab[] = {
 /* 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 },
-
-	{ "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 },
-
-	{ "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 },
+	{ "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)	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)	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 }
 };



CVS commit: src/usr.bin/mail

2021-12-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 14 15:13:42 UTC 2021

Modified Files:
src/usr.bin/mail: cmdtab.c

Log Message:
PR/56548: RVP: mail(1) segfaults if thread commands are used in ~/.mailrc


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/mail/cmdtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2021-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 10 16:42:47 UTC 2021

Modified Files:
src/usr.bin/mail: complete.c

Log Message:
s/struture/structure/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mail/complete.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/complete.c
diff -u src/usr.bin/mail/complete.c:1.23 src/usr.bin/mail/complete.c:1.24
--- src/usr.bin/mail/complete.c:1.23	Mon Dec 16 22:55:45 2019
+++ src/usr.bin/mail/complete.c	Wed Nov 10 16:42:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: complete.c,v 1.23 2019/12/16 22:55:45 christos Exp $	*/
+/*	$NetBSD: complete.c,v 1.24 2021/11/10 16:42:47 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2000,2005,2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: complete.c,v 1.23 2019/12/16 22:55:45 christos Exp $");
+__RCSID("$NetBSD: complete.c,v 1.24 2021/11/10 16:42:47 msaitoh Exp $");
 #endif /* not lint */
 
 /*
@@ -1078,7 +1078,7 @@ mime_enc_complete(EditLine *el, int ch)
  * Our public interface to el_gets():
  *
  * init_editline()
- *Initializes of all editline and completion data strutures.
+ *Initializes of all editline and completion data structures.
  *
  * my_gets()
  *Displays prompt, calls el_gets() and deals with history.



CVS commit: src/usr.bin/mail

2021-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 10 16:42:47 UTC 2021

Modified Files:
src/usr.bin/mail: complete.c

Log Message:
s/struture/structure/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mail/complete.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2021-11-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  1 20:40:08 UTC 2021

Modified Files:
src/usr.bin/mail: mail.1

Log Message:
mail.1: fix duplicate word


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/mail/mail.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/mail.1
diff -u src/usr.bin/mail/mail.1:1.68 src/usr.bin/mail/mail.1:1.69
--- src/usr.bin/mail/mail.1:1.68	Sat Dec 14 20:23:38 2019
+++ src/usr.bin/mail/mail.1	Mon Nov  1 20:40:08 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mail.1,v 1.68 2019/12/14 20:23:38 christos Exp $
+.\"	$NetBSD: mail.1,v 1.69 2021/11/01 20:40:08 rillig Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -257,7 +257,7 @@ negated with
 If the binary operator is missing between two message specs, it is
 assumed to be a
 .Ql \&| .
-This is for simplicity, backwards compatibility, and also to to
+This is for simplicity, backwards compatibility, and also to
 facilitate using the
 .Ql \&|
 symbol to denote a pipe.



CVS commit: src/usr.bin/mail

2021-11-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  1 20:40:08 UTC 2021

Modified Files:
src/usr.bin/mail: mail.1

Log Message:
mail.1: fix duplicate word


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/mail/mail.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2019-09-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Sep  1 19:10:39 UTC 2019

Modified Files:
src/usr.bin/mail: mail.1

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/mail/mail.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/mail.1
diff -u src/usr.bin/mail/mail.1:1.66 src/usr.bin/mail/mail.1:1.67
--- src/usr.bin/mail/mail.1:1.66	Sun Sep  1 18:24:28 2019
+++ src/usr.bin/mail/mail.1	Sun Sep  1 19:10:39 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mail.1,v 1.66 2019/09/01 18:24:28 sevan Exp $
+.\"	$NetBSD: mail.1,v 1.67 2019/09/01 19:10:39 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -61,7 +61,6 @@ is an intelligent mail processing system
 a command syntax reminiscent of
 .Xr \ 1
 with lines replaced by messages.
-.Pp
 .Bl -tag -width flag
 .It Fl a
 Attach
@@ -1136,7 +1135,6 @@ Note:
 .Ic sort
 has no effect on the threading, sorting only on the heads
 of the threads if threads exist.
-.Pp
 .It Ic source
 The
 .Ic source
@@ -2238,7 +2236,6 @@ parts using
 (assuming it is installed) and add this support to
 .Ql multipart/alternative
 blocks:
-.Pp
 .Bd -literal -offset indent
 set mime-body-text-html="+/usr/pkg/bin/lynx -force_html -dump -stdin"
 .Ed



CVS commit: src/usr.bin/mail

2019-09-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Sep  1 19:10:39 UTC 2019

Modified Files:
src/usr.bin/mail: mail.1

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/mail/mail.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2019-09-01 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Sep  1 18:24:28 UTC 2019

Modified Files:
src/usr.bin/mail: mail.1

Log Message:
mail was in v1
https://www.bell-labs.com/usr/dmr/www/man12.pdf


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/mail/mail.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/mail.1
diff -u src/usr.bin/mail/mail.1:1.65 src/usr.bin/mail/mail.1:1.66
--- src/usr.bin/mail/mail.1:1.65	Fri Jul 26 13:05:30 2019
+++ src/usr.bin/mail/mail.1	Sun Sep  1 18:24:28 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mail.1,v 1.65 2019/07/26 13:05:30 christos Exp $
+.\"	$NetBSD: mail.1,v 1.66 2019/09/01 18:24:28 sevan Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)mail.1	8.8 (Berkeley) 4/28/95
 .\"
-.Dd July 26, 2019
+.Dd September 1, 2019
 .Dt MAIL 1
 .Os
 .Sh NAME
@@ -2290,7 +2290,7 @@ A
 .Nm
 command
 appeared in
-.At v6 .
+.At v1 .
 This man page is derived from
 .Dq The Mail Reference Manual
 originally written by Kurt Shoens.



CVS commit: src/usr.bin/mail

2019-09-01 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Sep  1 18:24:28 UTC 2019

Modified Files:
src/usr.bin/mail: mail.1

Log Message:
mail was in v1
https://www.bell-labs.com/usr/dmr/www/man12.pdf


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/mail/mail.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/mail

2019-07-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul 26 13:05:31 UTC 2019

Modified Files:
src/usr.bin/mail: mail.1

Log Message:
PR/54410: fmoon: typos in mail(1)


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/mail/mail.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/mail.1
diff -u src/usr.bin/mail/mail.1:1.64 src/usr.bin/mail/mail.1:1.65
--- src/usr.bin/mail/mail.1:1.64	Tue May 22 21:03:46 2018
+++ src/usr.bin/mail/mail.1	Fri Jul 26 09:05:30 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mail.1,v 1.64 2018/05/23 01:03:46 christos Exp $
+.\"	$NetBSD: mail.1,v 1.65 2019/07/26 13:05:30 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)mail.1	8.8 (Berkeley) 4/28/95
 .\"
-.Dd May 22, 2018
+.Dd July 26, 2019
 .Dt MAIL 1
 .Os
 .Sh NAME
@@ -407,7 +407,7 @@ Unexamined messages go back to the post 
 .Fl f
 option above).
 .Ss Personal and system wide distribution lists
-It is also possible to create a personal distribution lists so that,
+It is also possible to create personal distribution lists so that,
 for instance, you can send mail to
 .Dq Li cohorts
 and have it go
@@ -1500,7 +1500,7 @@ For example, assuming normal headers, so
   from john@ | fgrep -i ' "Re:' | wc
 .Ed
 .Pp
-could be used to count how may replies were made by senders with
+could be used to count how many replies were made by senders with
 .Ql john@
 in their address and
 .Bd -literal -offset indent
@@ -1783,7 +1783,7 @@ If unset, editing is not enabled.
 support.)
 .It Ar el-history-size
 The number of lines of history to remember.
-If unset, history is not enable.
+If unset, history is not enabled.
 (Requires
 .Xr editline 3
 support.)



CVS commit: src/usr.bin/mail

2019-07-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul 26 13:05:31 UTC 2019

Modified Files:
src/usr.bin/mail: mail.1

Log Message:
PR/54410: fmoon: typos in mail(1)


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/mail/mail.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.bin/mail

2018-05-23 Thread Christos Zoulas
In article <20180523065522.ga18...@homeworld.netbsd.org>,
  wrote:
>You don't get to sneak a controversial change by omitting a real commit
>message.

το λακωνίζειν εστί φιλοσοφείν 

christos



Re: CVS commit: src/usr.bin/mail

2018-05-23 Thread maya
You don't get to sneak a controversial change by omitting a real commit
message.

On Tue, May 22, 2018 at 09:03:47PM -0400, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Wed May 23 01:03:46 UTC 2018
> 
> Modified Files:
>   src/usr.bin/mail: Makefile mail.1
> 
> Log Message:
> Remove Mail
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.36 -r1.37 src/usr.bin/mail/Makefile
> cvs rdiff -u -r1.63 -r1.64 src/usr.bin/mail/mail.1
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 

> Modified files:
> 
> Index: src/usr.bin/mail/Makefile
> diff -u src/usr.bin/mail/Makefile:1.36 src/usr.bin/mail/Makefile:1.37
> --- src/usr.bin/mail/Makefile:1.36Sat Jul  5 15:22:04 2014
> +++ src/usr.bin/mail/Makefile Tue May 22 21:03:46 2018
> @@ -1,4 +1,4 @@
> -#$NetBSD: Makefile,v 1.36 2014/07/05 19:22:04 dholland Exp $
> +#$NetBSD: Makefile,v 1.37 2018/05/23 01:03:46 christos Exp $
>  #@(#)Makefile8.3 (Berkeley) 4/20/95
>  
>  .include 
> @@ -26,8 +26,8 @@ SRCS=   version.c support.c cmd1.c cmd2.c 
>   dotlock.c edit.c fio.c format.c getname.c head.c v7.local.c lex.c \
>   list.c main.c names.c popen.c quit.c send.c sig.c strings.c temp.c \
>   tty.c vars.c
> -LINKS=   ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx
> -MLINKS=  mail.1 Mail.1 mail.1 mailx.1
> +LINKS=   ${BINDIR}/mail ${BINDIR}/mailx
> +MLINKS=  mail.1 mailx.1
>  
>  LDADD+=  -lutil
>  DPADD+=  ${LIBUTIL}
> 
> Index: src/usr.bin/mail/mail.1
> diff -u src/usr.bin/mail/mail.1:1.63 src/usr.bin/mail/mail.1:1.64
> --- src/usr.bin/mail/mail.1:1.63  Mon Jul  3 17:34:20 2017
> +++ src/usr.bin/mail/mail.1   Tue May 22 21:03:46 2018
> @@ -1,4 +1,4 @@
> -.\"  $NetBSD: mail.1,v 1.63 2017/07/03 21:34:20 wiz Exp $
> +.\"  $NetBSD: mail.1,v 1.64 2018/05/23 01:03:46 christos Exp $
>  .\"
>  .\" Copyright (c) 1980, 1990, 1993
>  .\"  The Regents of the University of California.  All rights reserved.
> @@ -29,13 +29,12 @@
>  .\"
>  .\"  @(#)mail.1  8.8 (Berkeley) 4/28/95
>  .\"
> -.Dd December 15, 2014
> +.Dd May 22, 2018
>  .Dt MAIL 1
>  .Os
>  .Sh NAME
>  .Nm mail ,
> -.Nm mailx ,
> -.Nm Mail
> +.Nm mailx
>  .Nd send and receive mail
>  .Sh SYNOPSIS
>  .Nm
> @@ -2299,11 +2298,14 @@ originally written by Kurt Shoens.
>  There are some flags and commands that are not documented here.
>  Most are not useful to the general user.
>  .Pp
> -Usually,
> +Historically,
>  .Nm
> -is just a link to
> +was just a link to
>  .Nm Mail ,
> -which can be confusing.
> +which was confusing.
> +.Nm Mail
> +has been removed in
> +.Nx 9 .
>  .Pp
>  The name of the
>  .Ic alternates
> 



Re: CVS commit: src/usr.bin/mail

2014-12-17 Thread Christos Zoulas
In article 20141217131849.r2prgpje%sdao...@yandex.com,
Steffen Nurpmeso  sdao...@yandex.com wrote:
This is fully yours and who am i but

 |Added expandaddr option to explicitly enable this behavior.

why does a Christos Zoulas silently wave through this sloppy
programmed shit from oss-sec that simply returns from outof()
instead of giving any indication on what is going on?
Unbelievable.

All you have to do is to set a variable to get the previous behavior,
and this is now documented. It is unexpected behavior that a mail
program can run commands on behalf of the user using special syntax.
Just a few weeks ago, we fixed a similar issue in ftp. Why didn't you
complain for that?

I believe that all maintained versions of mail upstream are being
adjusted to comply with this. What's the downside?

Or are you sure that everything that passes addresses to the mail
program command line sanitizes their addresses properly?

christos



Re: CVS commit: src/usr.bin/mail

2014-12-17 Thread Steffen Nurpmeso
This is fully yours and who am i but

Christos Zoulas chris...@netbsd.org wrote:
 |Module Name:  src
 |Committed By: christos
 |Date: Tue Dec 16 19:30:24 UTC 2014
 |
 |Modified Files:
 | src/usr.bin/mail: cmd3.c extern.h fio.c mail.1 names.c send.c
 |
 |Log Message:
 |Fix various security related issues:
 |
 |0001. Do not recognize paths, mail folders, and pipes in mail addresses
 |by default.  That avoids a direct command injection with syntactically
 |valid email addresses starting with |.
 |
 |Such addresses can be specified both on the command line, the mail
 |headers (with -t) or in address lines copied over from previous
 |while replying.

 |Added expandaddr option to explicitly enable this behavior.

why does a Christos Zoulas silently wave through this sloppy
programmed shit from oss-sec that simply returns from outof()
instead of giving any indication on what is going on?
Unbelievable.

--steffen


Re: CVS commit: src/usr.bin/mail

2014-12-17 Thread Christos Zoulas
In article 20141217142550.ne2degkj%sdao...@yandex.com,
Steffen Nurpmeso  sdao...@yandex.com wrote:

No, of course not -- except that validate user input screams
from every wall.  Maybe i'm just disappointed.  But any
environment that passes a string that includes shell meta
characters through to whatever else seems broken.  Tomorrow BSD
Mail / POSIX mailx(1) get a CVE for QoS attacks because of passing
through malformed addresses to MTAs that lead to nowhere but cause
several process lifetimes and log entries...  That doesn't seem
right.

It is to protect the innocent. Consider someone writing his first
cgi script and wants to add mail functionality :-) Perhaps as people
claimed mail/mailx is beyond hope...

christos



Re: CVS commit: src/usr.bin/mail

2014-12-17 Thread Steffen Nurpmeso
chris...@astron.com (Christos Zoulas) wrote:
 |In article 20141217131849.r2prgpje%sdao...@yandex.com,
 |Steffen Nurpmeso  sdao...@yandex.com wrote:
 |This is fully yours and who am i but
 |
 ||Added expandaddr option to explicitly enable this behavior.
 |
 |why does a Christos Zoulas silently wave through this sloppy
 |programmed shit from oss-sec that simply returns from outof()
 |instead of giving any indication on what is going on?
 |Unbelievable.
 |
 |All you have to do is to set a variable to get the previous behavior,
 |and this is now documented. It is unexpected behavior that a mail
 |program can run commands on behalf of the user using special syntax.
 |Just a few weeks ago, we fixed a similar issue in ftp. Why didn't you
 |complain for that?

ftp is completely beyond my horizon except for open/close/mreget.
What is expected behaviour.  But yes it is better if there are
ways to disable it, i also see this now.

 |I believe that all maintained versions of mail upstream are being
 |adjusted to comply with this. What's the downside?

It seems i'm the last.  Missing checks, complete silence, no
report at all, e.g. exit status.  Bad programs.

 |Or are you sure that everything that passes addresses to the mail
 |program command line sanitizes their addresses properly?

No, of course not -- except that validate user input screams
from every wall.  Maybe i'm just disappointed.  But any
environment that passes a string that includes shell meta
characters through to whatever else seems broken.  Tomorrow BSD
Mail / POSIX mailx(1) get a CVE for QoS attacks because of passing
through malformed addresses to MTAs that lead to nowhere but cause
several process lifetimes and log entries...  That doesn't seem
right.

--steffen


Re: CVS commit: src/usr.bin/mail

2013-01-03 Thread Christos Zoulas
In article 20130104015455.d9d3e17...@cvs.netbsd.org,
Christos Zoulas source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

Module Name:   src
Committed By:  christos
Date:  Fri Jan  4 01:54:55 UTC 2013

Modified Files:
   src/usr.bin/mail: mime_attach.c

Log Message:
PR/47396: Steffen: mail(1) may falsely use quoted-printable for files with
embedded NULs

Log message fixed on cvs.

christos



CVS commit: src/usr.bin/mail

2010-01-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 12 14:44:24 UTC 2010

Modified Files:
src/usr.bin/mail: complete.c

Log Message:
- 1 - EXIT_FAILURE
- avoid assertion firing when hitting ^D in CC: line.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/mail/complete.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.