lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 18 Jun 2010 15:20:01 -0700
From:	Howard Chu <hyc@...as.com>
To:	linux-kernel@...r.kernel.org
CC:	alan@...rguk.ukuu.org.uk, greg@...ah.com
Subject: Re: [PATCH] tty: Add EXTPROC support for LINEMODE

hyc@...as.com wrote:
> This patch is against the 2.6.34 source.
> @@ -1632,6 +1638,11 @@ static int copy_from_read_buf(struct tty_struct *tty,
>   		spin_lock_irqsave(&tty->read_lock, flags);
>   		tty->read_tail = (tty->read_tail + n)&  (N_TTY_BUF_SIZE-1);
>   		tty->read_cnt -= n;
> +		/* Check if last character is EOF */
> +		if (L_EXTPROC(tty)&&  tty->icanon) {
> +			if (!tty->read_cnt&&  (*b)[n-1] == EOF_CHAR(tty))
> +				n--;
> +		}
>   		spin_unlock_irqrestore(&tty->read_lock, flags);
>   		*b += n;
>   		*nr -= n;

This bit is wrong, only a naked EOF all by itself should be dropped. Should 
add this to the above:

diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index bba123e..428f4fe 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1638,8 +1638,8 @@ static int copy_from_read_buf(struct tty_struct *tty,
                 spin_lock_irqsave(&tty->read_lock, flags);
                 tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1);
                 tty->read_cnt -= n;
-               /* Check if last character is EOF */
-               if (L_EXTPROC(tty) && tty->icanon) {
+               /* Turn single EOF into zero-length read */
+               if (L_EXTPROC(tty) && tty->icanon && n == 1) {
                         if (!tty->read_cnt && (*b)[n-1] == EOF_CHAR(tty))
                                 n--;
                 }


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ