aboutsummaryrefslogtreecommitdiff
path: root/nss/nss_db
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-11 11:09:56 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-11 11:09:56 +0000
commit3d76e7784700c20fc222920b2a22baba006daa15 (patch)
tree7a44d4b9a084cf4b9ef6e44555a7ce8840f2d681 /nss/nss_db
parentbc526b60ee5c7cc9fe0540c94d72caf486a41675 (diff)
downloadglibc-3d76e7784700c20fc222920b2a22baba006daa15.tar
glibc-3d76e7784700c20fc222920b2a22baba006daa15.tar.gz
glibc-3d76e7784700c20fc222920b2a22baba006daa15.tar.bz2
glibc-3d76e7784700c20fc222920b2a22baba006daa15.zip
Update.
1998-03-11 Ulrich Drepper <drepper@cygnus.com> * nss/nss_db/db-XXX.c (lookup): Copy data to safe place before parsing it.
Diffstat (limited to 'nss/nss_db')
-rw-r--r--nss/nss_db/db-XXX.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index 1340b77de0..62c7a251f1 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -1,5 +1,5 @@
/* Common code for DB-based databases in nss_db module.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 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
@@ -176,10 +176,19 @@ lookup (const DBT *key, struct STRUCTURE *result,
H_ERRNO_SET (HOST_NOT_FOUND);
status = NSS_STATUS_NOTFOUND;
}
+ else if (buflen < value.size)
+ {
+ /* No room to copy the data to. */
+ *errnop = ERANGE;
+ H_ERRNO_SET (NETDB_INTERNAL);
+ status = NSS_STATUS_TRYAGAIN;
+ }
else
{
+ /* Copy the result to a safe place. */
+ p = (char *) memcpy (buffer, value.data, value.size);
+
/* Skip leading blanks. */
- p = (char *) value.data;
while (isspace (*p))
++p;