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_getai.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'nscd/nscd_getai.c') diff --git a/nscd/nscd_getai.c b/nscd/nscd_getai.c index a683976d87..390b981f99 100644 --- a/nscd/nscd_getai.c +++ b/nscd/nscd_getai.c @@ -142,6 +142,12 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop) /* Copy the data in the block. */ memcpy (resultbuf + 1, respdata, datalen); + /* Try to detect corrupt databases. */ + if (resultbuf->canon != NULL + && resultbuf->canon[ai_resp->canonlen - 1] != '\0') + /* We cannot use the database. */ + goto out_close; + retval = 0; *result = resultbuf; } @@ -157,6 +163,7 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop) retval = 0; } + out_close: if (sock != -1) close_not_cancel_no_status (sock); out: -- cgit v1.2.3