[3058] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

krb5-libs/704: getchar return value

daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Thu Mar 25 12:54:06 1999

Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: krb5-unassigned@RT-11.MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, ghudson@MIT.EDU
Date: Thu, 25 Mar 1999 12:53:32 -0500 (EST)
From: ghudson@MIT.EDU
Reply-To: ghudson@MIT.EDU
To: krb5-bugs@MIT.EDU


>Number:         704
>Category:       krb5-libs
>Synopsis:       getchar returns int
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    krb5-unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Thu Mar 25 12:54:01 EST 1999
>Last-Modified:
>Originator:     Greg Hudson
>Organization:
MIT
>Release:        1.0
>Environment:
	
System: NetBSD nephthys.grey17.org 1.3.2 NetBSD 1.3.2 (ATHENA) #0: Mon Jun 22 17:32:46 EDT 1998 nathanw@antisnork.mit.edu:/u1/var/build/sys-1.3.2/arch/i386/compile/ATHENA i386


>Description:
src/lib/krb5/os/promptusr.c uses a char variable for the return value of
getchar(), which returns an int (EOF not being a valid char value in all
cases).
>How-To-Repeat:
On a platform with unsigned char, convince krb5_os_get_tty_uio() to flush
the rest of a line and have it reach the end of the input stream.

Or just get a compiler warning about the comparison between a char value
and EOF.
>Fix:

Index: promptusr.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/third/krb5/src/lib/krb5/os/promptusr.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 promptusr.c
*** promptusr.c	1996/09/12 04:45:06	1.1.1.1
--- promptusr.c	1999/03/25 17:49:31
***************
*** 48,54 ****
      int 		fd;
      char		read_string[BUFSIZ];
      char		*cp;
!     char		ch;
  
      /* get the file descriptor associated with stdin */
      fd=fileno(stdin);
--- 48,54 ----
      int 		fd;
      char		read_string[BUFSIZ];
      char		*cp;
!     int			ch;
  
      /* get the file descriptor associated with stdin */
      fd=fileno(stdin);
>Audit-Trail:
>Unformatted:

home help back first fref pref prev next nref lref last post