diff options
Diffstat (limited to 'contrib/bind/lib/irs/hesiod.c')
-rw-r--r-- | contrib/bind/lib/irs/hesiod.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/contrib/bind/lib/irs/hesiod.c b/contrib/bind/lib/irs/hesiod.c index 2b08911..5afe661 100644 --- a/contrib/bind/lib/irs/hesiod.c +++ b/contrib/bind/lib/irs/hesiod.c @@ -1,5 +1,5 @@ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: hesiod.c,v 1.22 2001/05/29 05:48:55 marka Exp $"; +static const char rcsid[] = "$Id: hesiod.c,v 1.23 2002/07/18 02:07:45 marka Exp $"; #endif /* @@ -98,8 +98,13 @@ hesiod_init(void **context) { errno = ENOMEM; goto cleanup; } +#ifdef HAVE_STRLCPY + strlcpy(ctx->LHS, DEF_LHS, strlen(DEF_LHS) + 1); + strlcpy(ctx->RHS, DEF_RHS, strlen(DEF_RHS) + 1); +#else strcpy(ctx->LHS, DEF_LHS); strcpy(ctx->RHS, DEF_RHS); +#endif #else goto cleanup; #endif @@ -109,18 +114,31 @@ hesiod_init(void **context) { * variable. */ if ((cp = getenv("HES_DOMAIN")) != NULL) { + size_t RHSlen = strlen(cp) + 2; if (ctx->RHS) free(ctx->RHS); - ctx->RHS = malloc(strlen(cp)+2); + ctx->RHS = malloc(RHSlen); if (!ctx->RHS) { errno = ENOMEM; goto cleanup; } - if (cp[0] == '.') + if (cp[0] == '.') { +#ifdef HAVE_STRLCPY + strlcpy(ctx->RHS, cp, RHSlen); +#else strcpy(ctx->RHS, cp); - else { +#endif + } else { +#ifdef HAVE_STRLCPY + strlcpy(ctx->RHS, ".", RHSlen); +#else strcpy(ctx->RHS, "."); +#endif +#ifdef HAVE_STRLCAT + strlcat(ctx->RHS, cp, RHSlen); +#else strcat(ctx->RHS, cp); +#endif } } |