diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-11-10 07:50:03 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-11-10 07:50:03 +0000 |
commit | 5429ff760a5544a34c5f05f16c01a7dffa505604 (patch) | |
tree | ff81df09d20cae4092329dc25a3ed32fe7c0fc66 /nscd/nscd_getai.c | |
parent | 81b5ae0811c4da3701d08afa07a9b9159aac56e5 (diff) | |
download | glibc-5429ff760a5544a34c5f05f16c01a7dffa505604.zip glibc-5429ff760a5544a34c5f05f16c01a7dffa505604.tar.gz glibc-5429ff760a5544a34c5f05f16c01a7dffa505604.tar.bz2 |
(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.
Diffstat (limited to 'nscd/nscd_getai.c')
-rw-r--r-- | nscd/nscd_getai.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/nscd/nscd_getai.c b/nscd/nscd_getai.c index a683976..390b981 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: |