summaryrefslogtreecommitdiff
path: root/nscd/nscd_getai.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/nscd_getai.c')
-rw-r--r--nscd/nscd_getai.c7
1 files changed, 7 insertions, 0 deletions
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: