From 3d76e7784700c20fc222920b2a22baba006daa15 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 11 Mar 1998 11:09:56 +0000 Subject: Update. 1998-03-11 Ulrich Drepper * nss/nss_db/db-XXX.c (lookup): Copy data to safe place before parsing it. --- nss/nss_db/db-XXX.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'nss/nss_db/db-XXX.c') 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; -- cgit 1.4.1