* [ECOS] Error in io\serial\current\src\common\tty.c
@ 2000-01-28 5:39 Alexander Hering
2000-01-28 6:16 ` Gary Thomas
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Hering @ 2000-01-28 5:39 UTC (permalink / raw)
To: eCos Discussion
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
Hello,
we have found an error in the tty driver.
When i press the backspace key, when no more characters are in the
buffer, the last input is printed again.
In function tty_read size is declared as unsigned int, and must not be
tested against a value below zero.
====> cyg_uint32 size, clen;
if ((c == '\b') || (c == 0x7F)) {
size -= 2; // erase one character + 'backspace' char
====> if (size < 0) size = 0;
Greetings
Alex
--
Fraunhofer-Einrichtung
Systeme der Kommunikationstechnik
Alexander Hering HansastraÃe 32
Dipl.-Ing. D-80686 München
Telefon: +49(0)89/547088-37
E-Mail: Hering@esk.fhg.de Telefax: +49(0)89/547088-25
begin:vcard
n:Hering;Alexander
tel;fax:+49(0)89/547088-20
tel;work:+49(0)89/547088-37
x-mozilla-html:TRUE
org:Fraunhofer-Einrichtung Systeme der Kommunikationstechnik (ESK)
adr:;;HansastraÃe 32/IV;München;Bayern;D-80686;Deutschland (Germany)
version:2.1
email;internet:Hering@esk.fhg.de
title:FhG - ESK
x-mozilla-cpt:;-31232
fn:Hering, Alexander
end:vcard
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [ECOS] Error in io\serial\current\src\common\tty.c
2000-01-28 5:39 [ECOS] Error in io\serial\current\src\common\tty.c Alexander Hering
@ 2000-01-28 6:16 ` Gary Thomas
2000-01-28 6:31 ` Alexander Hering
0 siblings, 1 reply; 4+ messages in thread
From: Gary Thomas @ 2000-01-28 6:16 UTC (permalink / raw)
To: Alexander Hering; +Cc: eCos Discussion
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]
A fix for this problem has already been installed.
We suggest that you use CVS to keep track of the [very] latest
eCos sources. See our web page ( http://sourceware.cygnus.com/ecos )
for the details.
On 28-Jan-00 Alexander Hering wrote:
> Hello,
>
> we have found an error in the tty driver.
> When i press the backspace key, when no more characters are in the
> buffer, the last input is printed again.
>
> In function tty_read size is declared as unsigned int, and must not be
> tested against a value below zero.
>
> ====> cyg_uint32 size, clen;
>
> if ((c == '\b') || (c == 0x7F)) {
> size -= 2; // erase one character + 'backspace' char
> ====> if (size < 0) size = 0;
>
> Greetings
>
> Alex
>
> --
> Fraunhofer-Einrichtung
> Systeme der Kommunikationstechnik
>
> Alexander Hering HansastraÃe 32
> Dipl.-Ing. D-80686 München
> Telefon: +49(0)89/547088-37
> E-Mail: Hering@esk.fhg.de Telefax: +49(0)89/547088-25
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ECOS] Error in io\serial\current\src\common\tty.c
2000-01-28 6:16 ` Gary Thomas
@ 2000-01-28 6:31 ` Alexander Hering
2000-01-28 7:31 ` Gary Thomas
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Hering @ 2000-01-28 6:31 UTC (permalink / raw)
To: Gary Thomas; +Cc: eCos Discussion
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2156 bytes --]
This is a copy of the actual version in CVS:
cyg_uint32 size, clen;
if ((c == '\b') || (c == 0x7F)) {
size -= 2; // erase one character + 'backspace' char
==> if (size < 0) {
size = 0;
} else if (priv->dev_info.tty_in_flags & CYG_TTY_IN_FLAGS_ECHO) {
clen = 3;
cyg_io_write(chan, "\b \b", &clen);
}
There is still the same problem. The variable size cannot be lower
than zero, because it is an unsigned type.
Gary Thomas schrieb:
>
> A fix for this problem has already been installed.
>
> We suggest that you use CVS to keep track of the [very] latest
> eCos sources. See our web page ( http://sourceware.cygnus.com/ecos )
> for the details.
>
> On 28-Jan-00 Alexander Hering wrote:
> > Hello,
> >
> > we have found an error in the tty driver.
> > When i press the backspace key, when no more characters are in the
> > buffer, the last input is printed again.
> >
> > In function tty_read size is declared as unsigned int, and must not be
> > tested against a value below zero.
> >
> > ====> cyg_uint32 size, clen;
> >
> > if ((c == '\b') || (c == 0x7F)) {
> > size -= 2; // erase one character + 'backspace' char
> > ====> if (size < 0) size = 0;
> >
> > Greetings
> >
> > Alex
> >
> > --
> > Fraunhofer-Einrichtung
> > Systeme der Kommunikationstechnik
> >
> > Alexander Hering HansastraÃe 32
> > Dipl.-Ing. D-80686 München
> > Telefon: +49(0)89/547088-37
> > E-Mail: Hering@esk.fhg.de Telefax: +49(0)89/547088-25
--
Fraunhofer-Einrichtung
Systeme der Kommunikationstechnik
Alexander Hering HansastraÃe 32
Dipl.-Ing. D-80686 München
Telefon: +49(0)89/547088-37
E-Mail: Hering@esk.fhg.de Telefax: +49(0)89/547088-25
begin:vcard
n:Hering;Alexander
tel;fax:+49(0)89/547088-20
tel;work:+49(0)89/547088-37
x-mozilla-html:TRUE
org:Fraunhofer-Einrichtung Systeme der Kommunikationstechnik (ESK)
adr:;;HansastraÃe 32/IV;München;Bayern;D-80686;Deutschland (Germany)
version:2.1
email;internet:Hering@esk.fhg.de
title:FhG - ESK
x-mozilla-cpt:;-31232
fn:Hering, Alexander
end:vcard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ECOS] Error in io\serial\current\src\common\tty.c
2000-01-28 6:31 ` Alexander Hering
@ 2000-01-28 7:31 ` Gary Thomas
0 siblings, 0 replies; 4+ messages in thread
From: Gary Thomas @ 2000-01-28 7:31 UTC (permalink / raw)
To: Alexander Hering; +Cc: eCos Discussion
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2881 bytes --]
On 28-Jan-00 Alexander Hering wrote:
>
> This is a copy of the actual version in CVS:
>
> cyg_uint32 size, clen;
>
> if ((c == '\b') || (c == 0x7F)) {
> size -= 2; // erase one character + 'backspace' char
> ==> if (size < 0) {
> size = 0;
> } else if (priv->dev_info.tty_in_flags & CYG_TTY_IN_FLAGS_ECHO) {
> clen = 3;
> cyg_io_write(chan, "\b \b", &clen);
> }
>
> There is still the same problem. The variable size cannot be lower
> than zero, because it is an unsigned type.
>
Good catch. Use this patch to fix it.
Index: io/serial/current//src/common/tty.c
===================================================================
RCS file: /local/cvsfiles/ecc/ecc/io/serial/current/src/common/tty.c,v
retrieving revision 1.8
diff -u -5 -p -r1.8 tty.c
--- io/serial/current//src/common/tty.c 2000/01/28 03:54:54 1.8
+++ io/serial/current//src/common/tty.c 2000/01/28 15:29:15
@@ -191,11 +191,12 @@ static Cyg_ErrNo
tty_read(cyg_io_handle_t handle, void *_buf, cyg_uint32 *len)
{
cyg_devtab_entry_t *t = (cyg_devtab_entry_t *)handle;
struct tty_private_info *priv = (struct tty_private_info *)t->priv;
cyg_io_handle_t chan = (cyg_io_handle_t)priv->dev_handle;
- cyg_uint32 size, clen;
+ cyg_uint32 clen;
+ cyg_int32 size;
Cyg_ErrNo res;
cyg_uint8 c;
cyg_uint8 *buf = (cyg_uint8 *)_buf;
// assert(chan)
size = 0;
> Gary Thomas schrieb:
>>
>> A fix for this problem has already been installed.
>>
>> We suggest that you use CVS to keep track of the [very] latest
>> eCos sources. See our web page ( http://sourceware.cygnus.com/ecos )
>> for the details.
>>
>> On 28-Jan-00 Alexander Hering wrote:
>> > Hello,
>> >
>> > we have found an error in the tty driver.
>> > When i press the backspace key, when no more characters are in the
>> > buffer, the last input is printed again.
>> >
>> > In function tty_read size is declared as unsigned int, and must not be
>> > tested against a value below zero.
>> >
>> > ====> cyg_uint32 size, clen;
>> >
>> > if ((c == '\b') || (c == 0x7F)) {
>> > size -= 2; // erase one character + 'backspace' char
>> > ====> if (size < 0) size = 0;
>> >
>> > Greetings
>> >
>> > Alex
>> >
>> > --
>> > Fraunhofer-Einrichtung
>> > Systeme der Kommunikationstechnik
>> >
>> > Alexander Hering HansastraÃe 32
>> > Dipl.-Ing. D-80686 München
>> > Telefon: +49(0)89/547088-37
>> > E-Mail: Hering@esk.fhg.de Telefax: +49(0)89/547088-25
>
> --
> Fraunhofer-Einrichtung
> Systeme der Kommunikationstechnik
>
> Alexander Hering HansastraÃe 32
> Dipl.-Ing. D-80686 München
> Telefon: +49(0)89/547088-37
> E-Mail: Hering@esk.fhg.de Telefax: +49(0)89/547088-25
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-01-28 7:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-28 5:39 [ECOS] Error in io\serial\current\src\common\tty.c Alexander Hering
2000-01-28 6:16 ` Gary Thomas
2000-01-28 6:31 ` Alexander Hering
2000-01-28 7:31 ` Gary Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).