about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-11-28 20:12:17 +0000
committerUlrich Drepper <drepper@redhat.com>2001-11-28 20:12:17 +0000
commit3fd13f9e1b426e341ebfbe6a25ce4087cfbd5506 (patch)
tree6de56e60f719ff11f1aef14d6d13434f112ccc7c
parentcd0392d8804bcee4b7b5ebb3c8f26dafbef37db3 (diff)
downloadglibc-3fd13f9e1b426e341ebfbe6a25ce4087cfbd5506.tar.gz
glibc-3fd13f9e1b426e341ebfbe6a25ce4087cfbd5506.tar.xz
glibc-3fd13f9e1b426e341ebfbe6a25ce4087cfbd5506.zip
Update.
2001-11-28  Ulrich Drepper  <drepper@redhat.com>

	* nss/nss_files/files-XXX.c (internal_getent): Correct input
	overflow test for platforms with signed char.
	Reported by Andrew Haley <aph@cambridge.redhat.com>.
-rw-r--r--ChangeLog6
-rw-r--r--nss/nss_files/files-XXX.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9157e18198..406c20fcbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-11-28  Ulrich Drepper  <drepper@redhat.com>
+
+	* nss/nss_files/files-XXX.c (internal_getent): Correct input
+	overflow test for platforms with signed char.
+	Reported by Andrew Haley <aph@cambridge.redhat.com>.
+
 2001-11-28  Bruno Haible  <bruno@clisp.org>
 
 	* locale/programs/simple-hash.c (lookup_2): Remove function.
diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
index 9992c3a1a2..da840595a4 100644
--- a/nss/nss_files/files-XXX.c
+++ b/nss/nss_files/files-XXX.c
@@ -1,5 +1,5 @@
 /* Common code for file-based databases in nss_files module.
-   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -185,7 +185,7 @@ internal_getent (struct STRUCTURE *result,
   do
     {
       /* Terminate the line so that we can test for overflow.  */
-      data->linebuffer[linebuflen - 1] = '\xff';
+      ((unsigned char *) data->linebuffer)[linebuflen - 1] = '\xff';
 
       p = fgets_unlocked (data->linebuffer, linebuflen, stream);
       if (p == NULL)
@@ -195,7 +195,7 @@ internal_getent (struct STRUCTURE *result,
 	  H_ERRNO_SET (HOST_NOT_FOUND);
 	  return NSS_STATUS_NOTFOUND;
 	}
-      else if (data->linebuffer[linebuflen - 1] != '\xff')
+      else if (((unsigned char *) data->linebuffer)[linebuflen - 1] != 0xff)
 	{
 	  /* The line is too long.  Give the user the opportunity to
 	     enlarge the buffer.  */