From 5429ff760a5544a34c5f05f16c01a7dffa505604 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 10 Nov 2004 07:50:03 +0000 Subject: (libc_locked_map_ptr): Add new first parameter, used as class for definition. * nscd/nscd-client.h (libc_locked_map_ptr): Add new first parameter, used as class for definition. * nscd/nscd_getpw_r.c: Adjust for libc_locked_map_ptr change. (pw_map_free): Ensure no crash after memory is freed. * nscd/nscd_getgr.c: Likewise. Make map externally visible. * nscd/nscd_gethst.c: Likewise. * nscd/nscd_getai.c: Use map from nscd_gethost.c. * nscd/nscd_initgroups.c: Use map from nscd_getgr.c. --- nscd/nscd_gethst_r.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nscd/nscd_gethst_r.c') diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c index 407be14..64d02fe 100644 --- a/nscd/nscd_gethst_r.c +++ b/nscd/nscd_gethst_r.c @@ -336,6 +336,16 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type, memcpy (resultbuf->h_aliases[0], (const char *) addr_list + addr_list_len, total_len); + /* Try to detect corrupt databases. */ + if (resultbuf->h_name[hst_resp->h_name_len - 1] != '\0' + || ({for (cnt = 0; cnt < hst_resp->h_aliases_cnt; ++cnt) + if (resultbuf->h_aliases[cnt][aliases_len[cnt] - 1] + != '\0') + break; + cnt < hst_resp->h_aliases_cnt; })) + /* We cannot use the database. */ + goto out_close; + retval = 0; *result = resultbuf; } -- cgit v1.1