1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-05 19:35:52 +03:00
1998-03-11  Ulrich Drepper  <drepper@cygnus.com>

	* nss/nss_db/db-XXX.c (lookup): Copy data to safe place before
	parsing it.
This commit is contained in:
Ulrich Drepper
1998-03-11 11:09:56 +00:00
parent bc526b60ee
commit 3d76e77847
3 changed files with 17 additions and 3 deletions

View File

@@ -1,3 +1,8 @@
1998-03-11 Ulrich Drepper <drepper@cygnus.com>
* nss/nss_db/db-XXX.c (lookup): Copy data to safe place before
parsing it.
1998-03-11 Andreas Jaeger <aj@arthur.rhein-neckar.de> 1998-03-11 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Use * sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Use

View File

@@ -402,7 +402,7 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
char buf[sizeof undefined_msg + len]; char buf[sizeof undefined_msg + len];
__mempcpy (__mempcpy (buf, undefined_msg, sizeof undefined_msg - 1), __mempcpy (__mempcpy (buf, undefined_msg, sizeof undefined_msg - 1),
undef_name, len + 1); undef_name, len + 1);
_dl_signal_error (0, (reference_namee && reference_name[0] _dl_signal_error (0, (reference_name && reference_name[0]
? reference_name ? reference_name
: (_dl_argv[0] ?: "<main program>")), buf); : (_dl_argv[0] ?: "<main program>")), buf);
} }

View File

@@ -1,5 +1,5 @@
/* Common code for DB-based databases in nss_db module. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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); H_ERRNO_SET (HOST_NOT_FOUND);
status = NSS_STATUS_NOTFOUND; 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 else
{ {
/* Copy the result to a safe place. */
p = (char *) memcpy (buffer, value.data, value.size);
/* Skip leading blanks. */ /* Skip leading blanks. */
p = (char *) value.data;
while (isspace (*p)) while (isspace (*p))
++p; ++p;