Commit 47b26abe authored by David Lawrence's avatar David Lawrence

ensure proper range for argument to ctype functions

parent f855bad4
162. [bug] Ensure proper range for arguments to ctype.h functions.
161. [cleanup] error in yyparse prototype that only HPUX caught.
160. [cleanup] getnet*() are not going to be implemented at this
......
......@@ -337,8 +337,10 @@ test_dns_db_zc_x(char *filename, isc_boolean_t cache,
++line;
/* skip comment lines */
if ((isspace((int)*p)) || (*p == '#'))
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
continue;
cnt = t_bustline(p, tokens);
......
This diff is collapsed.
......@@ -435,7 +435,7 @@ test_dns_rbt_x(char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((int)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#'))
continue;
/*
......@@ -919,8 +919,10 @@ test_dns_rbtnodechain_init(char *filename) {
++line;
/* skip comment lines */
if ((isspace((int)*p)) || (*p == '#'))
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
continue;
cnt = t_bustline(p, Tokens);
......@@ -1082,7 +1084,7 @@ test_dns_rbtnodechain_first(char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((int)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#'))
continue;
cnt = t_bustline(p, Tokens);
......@@ -1247,7 +1249,7 @@ test_dns_rbtnodechain_last(char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((int)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#'))
continue;
cnt = t_bustline(p, Tokens);
......@@ -1428,7 +1430,7 @@ test_dns_rbtnodechain_next(char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((int)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#'))
continue;
cnt = t_bustline(p, Tokens);
......@@ -1607,7 +1609,7 @@ test_dns_rbtnodechain_prev(char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((int)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#'))
continue;
cnt = t_bustline(p, Tokens);
......
......@@ -16,7 +16,7 @@
* SOFTWARE.
*/
/* $Id: confparser.y,v 1.76 2000/05/09 16:49:50 brister Exp $ */
/* $Id: confparser.y,v 1.77 2000/05/09 22:22:15 tale Exp $ */
#include <config.h>
......@@ -5496,7 +5496,7 @@ unit_to_uint32(char *in, isc_uint32_t *out) {
for (; (c = *in) != '\0'; in++) {
if (units_done)
return (ISC_FALSE);
if (isdigit(c)) {
if (isdigit((unsigned char)c)) {
result *= 10;
result += (c - '0');
} else {
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: gen.c,v 1.45 2000/05/08 14:34:36 tale Exp $ */
/* $Id: gen.c,v 1.46 2000/05/09 22:22:11 tale Exp $ */
#include <config.h>
......@@ -34,31 +34,38 @@
#include "gen-unix.h"
#endif
#define FROMTEXTDECL "dns_rdataclass_t rdclass, dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin, isc_boolean_t downcase, isc_buffer_t *target"
#define FROMTEXTDECL "dns_rdataclass_t rdclass, dns_rdatatype_t type, " \
"isc_lex_t *lexer, dns_name_t *origin, " \
"isc_boolean_t downcase, isc_buffer_t *target"
#define FROMTEXTARGS "rdclass, type, lexer, origin, downcase, target"
#define FROMTEXTCLASS "rdclass"
#define FROMTEXTTYPE "type"
#define FROMTEXTDEF "use_default = ISC_TRUE"
#define TOTEXTDECL "dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, isc_buffer_t *target"
#define TOTEXTDECL "dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, " \
"isc_buffer_t *target"
#define TOTEXTARGS "rdata, tctx, target"
#define TOTEXTCLASS "rdata->rdclass"
#define TOTEXTTYPE "rdata->type"
#define TOTEXTDEF "use_default = ISC_TRUE"
#define FROMWIREDECL "dns_rdataclass_t rdclass, dns_rdatatype_t type, isc_buffer_t *source, dns_decompress_t *dctx, isc_boolean_t downcase, isc_buffer_t *target"
#define FROMWIREDECL "dns_rdataclass_t rdclass, dns_rdatatype_t type, " \
"isc_buffer_t *source, dns_decompress_t *dctx, " \
"isc_boolean_t downcase, isc_buffer_t *target"
#define FROMWIREARGS "rdclass, type, source, dctx, downcase, target"
#define FROMWIRECLASS "rdclass"
#define FROMWIRETYPE "type"
#define FROMWIREDEF "use_default = ISC_TRUE"
#define TOWIREDECL "dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target"
#define TOWIREDECL "dns_rdata_t *rdata, dns_compress_t *cctx, " \
"isc_buffer_t *target"
#define TOWIREARGS "rdata, cctx, target"
#define TOWIRECLASS "rdata->rdclass"
#define TOWIRETYPE "rdata->type"
#define TOWIREDEF "use_default = ISC_TRUE"
#define FROMSTRUCTDECL "dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source, isc_buffer_t *target"
#define FROMSTRUCTDECL "dns_rdataclass_t rdclass, dns_rdatatype_t type, " \
"void *source, isc_buffer_t *target"
#define FROMSTRUCTARGS "rdclass, type, source, target"
#define FROMSTRUCTCLASS "rdclass"
#define FROMSTRUCTTYPE "type"
......@@ -104,14 +111,14 @@ char copyright[] =
" * purpose with or without fee is hereby granted, provided that the above\n"
" * copyright notice and this permission notice appear in all copies.\n"
" *\n"
" * THE SOFTWARE IS PROVIDED \"AS IS\" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS\n"
" * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES\n"
" * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE\n"
" * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL\n"
" * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR\n"
" * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n"
" * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n"
" * SOFTWARE.\n"
" * THE SOFTWARE IS PROVIDED \"AS IS\" AND INTERNET SOFTWARE CONSORTIUM\n"
" * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL\n"
" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL\n"
" * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,\n"
" * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING\n"
" * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,\n"
" * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION\n"
" * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"
" */\n"
"\n"
"/***************\n"
......@@ -372,8 +379,9 @@ add(int rdclass, char *classname, int type, char *typename, char *dirname) {
else
types = newtt;
/* do a class switch for this type */
/*
* Do a class switch for this type.
*/
if (rdclass == 0)
return;
......@@ -585,8 +593,10 @@ main(int argc, char **argv) {
#define PRINT_COMMA(x) (x == 255 ? "" : ",")
#define METANOTQUESTION "DNS_RDATATYPEATTR_META | DNS_RDATATYPEATTR_NOTQUESTION"
#define METAQUESTIONONLY "DNS_RDATATYPEATTR_META | DNS_RDATATYPEATTR_QUESTIONONLY"
#define METANOTQUESTION "DNS_RDATATYPEATTR_META | " \
"DNS_RDATATYPEATTR_NOTQUESTION"
#define METAQUESTIONONLY "DNS_RDATATYPEATTR_META | " \
"DNS_RDATATYPEATTR_QUESTIONONLY"
#define RESERVED "DNS_RDATATYPEATTR_RESERVED"
/*
......@@ -649,14 +659,16 @@ main(int argc, char **argv) {
printf("#define RDATATYPE_COMPARE(_s, _d, _tn, _tp) \\\n");
printf("\tdo { \\\n");
printf("\t\tif (strcasecmp(_s,(_tn)) == 0) { \\\n");
printf("\t\t\tif ((typeattr[_d].flags & DNS_RDATATYPEATTR_RESERVED) != 0) \\\n");
printf("\t\t\tif ((typeattr[_d].flags & "
"DNS_RDATATYPEATTR_RESERVED) != 0) \\\n");
printf("\t\t\t\treturn (ISC_R_NOTIMPLEMENTED); \\\n");
printf("\t\t\t*(_tp) = _d; \\\n");
printf("\t\t\treturn (ISC_R_SUCCESS); \\\n");
printf("\t\t} \\\n");
printf("\t} while (0)\n\n");
printf("#define RDATATYPE_FROMTEXT_SW(_hash,_typename,_typep) \\\n");
printf("#define RDATATYPE_FROMTEXT_SW(_hash,_typename,_typep) "
"\\\n");
printf("\tswitch (_hash) { \\\n");
for (i = 0 ; i <= 255 ; i++) {
ttn = &typenames[i];
......@@ -679,7 +691,9 @@ main(int argc, char **argv) {
if (ttn2->sorted != 0)
continue;
if (hash == HASH(ttn2->typename)) {
printf("\t\t\tRDATATYPE_COMPARE(\"%s\", %u, _typename, _typep); \\\n",
printf("\t\t\tRDATATYPE_COMPARE"
"(\"%s\", %u, "
"_typename, _typep); \\\n",
ttn2->typename, j);
ttn2->sorted = 1;
}
......@@ -713,7 +727,8 @@ main(int argc, char **argv) {
lasttype = 0;
for (tt = types; tt != NULL ; tt = tt->next)
if (tt->type != lasttype)
fprintf(stdout, "\t dns_rdatatype_%s = %d,%s\n",
fprintf(stdout,
"\t dns_rdatatype_%s = %d,%s\n",
funname(tt->typename, buf1),
lasttype = tt->type,
tt->next != NULL ? " \\" : "");
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: rdata.c,v 1.87 2000/05/09 12:07:32 tale Exp $ */
/* $Id: rdata.c,v 1.88 2000/05/09 22:22:12 tale Exp $ */
#include <config.h>
......@@ -812,8 +812,8 @@ dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
if (n == 0)
return (DNS_R_UNKNOWN);
a = tolower(source->base[0]);
b = tolower(source->base[n - 1]);
a = tolower((unsigned char)source->base[0]);
b = tolower((unsigned char)source->base[n - 1]);
hash = ((a + n) * b) % 256;
......@@ -1308,10 +1308,14 @@ compare_region(isc_region_t *r1, isc_region_t *r2) {
static int
hexvalue(char value) {
char *s;
if (!isascii(value & 0xff))
unsigned char c;
c = (unsigned char)value;
if (!isascii(c))
return (-1);
if (isupper(value & 0xff))
value = tolower(value);
if (isupper(c))
c = tolower(c);
if ((s = strchr(hexdigits, value)) == NULL)
return (-1);
return (s - hexdigits);
......@@ -1320,7 +1324,12 @@ hexvalue(char value) {
static int
decvalue(char value) {
char *s;
if (!isascii(value&0xff))
/*
* isascii() is valid for full range of int values, no need to
* mask or cast.
*/
if (!isascii(value))
return (-1);
if ((s = strchr(decdigits, value)) == NULL)
return (-1);
......@@ -1328,7 +1337,8 @@ decvalue(char value) {
}
static const char atob_digits[86] =
"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstu";
"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" \
"abcdefghijklmnopqrstu";
/*
* Subroutines to convert between 8 bit binary bytes and printable ASCII.
* Computes the number of bytes, and three kinds of simple checksums.
......
......@@ -19,7 +19,7 @@
/*
* Principal Author: Brian Wellington
* $Id: openssldh_link.c,v 1.12 2000/05/08 14:37:09 tale Exp $
* $Id: openssldh_link.c,v 1.13 2000/05/09 22:22:16 tale Exp $
*/
#if defined(OPENSSL)
......@@ -687,11 +687,11 @@ BN_fromhex(BIGNUM *b, const char *str) {
char *s;
unsigned int high, low;
s = strchr(hexdigits, tolower(str[i]));
s = strchr(hexdigits, tolower((unsigned char)str[i]));
RUNTIME_CHECK(s != NULL);
high = s - hexdigits;
s = strchr(hexdigits, tolower(str[i + 1]));
s = strchr(hexdigits, tolower((unsigned char)str[i + 1]));
RUNTIME_CHECK(s != NULL);
low = s - hexdigits;
......
......@@ -109,6 +109,9 @@ dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target) {
/*
* The unit letter is the last character in the
* used region of the buffer.
*
* toupper() does not need its argument to be masked of cast
* here because region.base is type unsigned char *.
*/
isc_buffer_usedregion(target, &region);
region.base[region.length - 1] =
......
......@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
static char rcsid[] = "$Id: inet_aton.c,v 1.8 1999/10/29 04:25:11 marka Exp $";
static char rcsid[] = "$Id: inet_aton.c,v 1.9 2000/05/09 22:22:18 tale Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
......@@ -88,8 +88,7 @@ static char rcsid[] = "$Id: inet_aton.c,v 1.8 1999/10/29 04:25:11 marka Exp $";
* cannot distinguish between failure and a local broadcast address.
*/
int
isc_net_aton(const char *cp, struct in_addr *addr)
{
isc_net_aton(const char *cp, struct in_addr *addr) {
unsigned long val;
int base, n;
char c;
......@@ -117,16 +116,21 @@ isc_net_aton(const char *cp, struct in_addr *addr)
}
}
for (;;) {
if (isascii(c & 0xff) && isdigit(c & 0xff)) {
/*
* isascii() is valid for all integer values, and
* when it is true, c is known to be in scope
* for isdigit(). No cast necessary. Similar
* comment applies for later ctype uses.
*/
if (isascii(c) && isdigit(c)) {
if (base == 8 && (c == '8' || c == '9'))
return (0);
val = (val * base) + (c - '0');
c = *++cp;
digit = 1;
} else if (base == 16 && isascii(c & 0xff) &&
isxdigit(c & 0xff)) {
} else if (base == 16 && isascii(c) && isxdigit(c)) {
val = (val << 4) |
(c + 10 - (islower(c & 0xff) ? 'a' : 'A'));
(c + 10 - (islower(c) ? 'a' : 'A'));
c = *++cp;
digit = 1;
} else
......@@ -149,7 +153,7 @@ isc_net_aton(const char *cp, struct in_addr *addr)
/*
* Check for trailing characters.
*/
if (c != '\0' && (!isascii(c & 0xff) || !isspace(c & 0xff)))
if (c != '\0' && (!isascii(c) || !isspace(c)))
return (0);
/*
* Did we get a valid digit?
......
......@@ -489,7 +489,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
tokenp->type = isc_tokentype_special;
tokenp->value.as_char = c;
done = ISC_TRUE;
} else if (isdigit(c) &&
} else if (isdigit((unsigned char)c) &&
(options & ISC_LEXOPT_NUMBER) != 0) {
lex->last_was_eol = ISC_FALSE;
state = lexstate_number;
......@@ -508,7 +508,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
lex->last_was_eol = ISC_TRUE;
break;
case lexstate_number:
if (!isdigit(c)) {
if (c == EOF || !isdigit((unsigned char)c)) {
if (c == ' ' || c == '\t' || c == '\r' ||
c == '\n' || c == EOF ||
lex->specials[c]) {
......
......@@ -97,7 +97,9 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
}
format++;
/* reset flags */
/*
* Reset flags.
*/
dot = neg = space = plus = left = zero = alt = h = l = q = 0;
width = precision = 0;
head = "";
......@@ -127,24 +129,28 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
break;
} while (1);
/* width */
/*
* Width.
*/
if (*format == '*') {
width = va_arg(ap, int);
format++;
} else if (isdigit(*format)) {
} else if (isdigit((unsigned char)*format)) {
char *e;
width = strtoul(format, &e, 10);
format = e;
}
/* precision */
/*
* Precision.
*/
if (*format == '.') {
format++;
dot = 1;
if (*format == '*') {
precision = va_arg(ap, int);
format++;
} else if (isdigit(*format)) {
} else if (isdigit((unsigned char)*format)) {
char *e;
precision = strtoul(format, &e, 10);
format = e;
......@@ -346,7 +352,9 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
REQUIRE(cp != NULL);
if (precision != 0) {
/* cp need not be NULL terminated */
/*
* cp need not be NULL terminated.
*/
char *tp;
unsigned long n;
......
......@@ -138,8 +138,7 @@ hash(const char *key, isc_boolean_t case_sensitive) {
} else {
for (s = key; *s != '\0'; s++) {
c = *s;
if (isascii(c) && isupper(c))
c = tolower(c);
c = tolower((unsigned char)c);
h = ( h << 4 ) + c;
if ((g = ( h & 0xf0000000 )) != 0) {
h = h ^ (g >> 24);
......
......@@ -96,8 +96,7 @@ lwres_create_addr(const char *buff, lwres_addr_t *addr);
* that caused the reading to stop.
*/
static int
getword(FILE *fp, char *buffer, size_t size)
{
getword(FILE *fp, char *buffer, size_t size) {
int ch;
char *p = buffer;
......@@ -107,7 +106,7 @@ getword(FILE *fp, char *buffer, size_t size)
*p = '\0';
ch = fgetc(fp);
while (ch != '\n' && isspace(ch))
while (ch != '\n' && ch != EOF && isspace((unsigned char)ch))
ch = fgetc(fp);
if (ch == EOF)
......@@ -116,10 +115,10 @@ getword(FILE *fp, char *buffer, size_t size)
do {
*p = '\0';
if (ch == EOF || isspace(ch))
if (ch == EOF || isspace((unsigned char)ch))
break;
else if ((size_t) (p - buffer) == size - 1)
return (EOF); /* not enough space */
return (EOF); /* Not enough space. */
*p++ = (char)ch;
ch = fgetc(fp);
......@@ -129,8 +128,7 @@ getword(FILE *fp, char *buffer, size_t size)
}
static void
lwres_resetaddr(lwres_addr_t *addr)
{
lwres_resetaddr(lwres_addr_t *addr) {
REQUIRE(addr != NULL);
memset(addr->address, 0, LWRES_ADDR_MAXLEN);
......@@ -139,8 +137,7 @@ lwres_resetaddr(lwres_addr_t *addr)
}
static char *
lwres_strdup(lwres_context_t *ctx, const char *str)
{
lwres_strdup(lwres_context_t *ctx, const char *str) {
char *p;
REQUIRE(str != NULL);
......@@ -154,8 +151,7 @@ lwres_strdup(lwres_context_t *ctx, const char *str)
}
void
lwres_conf_init(lwres_context_t *ctx)
{
lwres_conf_init(lwres_context_t *ctx) {
int i;
lwres_conf_t *confdata;
......@@ -183,8 +179,7 @@ lwres_conf_init(lwres_context_t *ctx)
}
void
lwres_conf_clear(lwres_context_t *ctx)
{
lwres_conf_clear(lwres_context_t *ctx) {
int i;
lwres_conf_t *confdata;
......@@ -223,8 +218,7 @@ lwres_conf_clear(lwres_context_t *ctx)
}
static lwres_result_t
lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp)
{
lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp) {
char word[LWRES_CONFMAXLINELEN];
int res;
lwres_conf_t *confdata;
......@@ -236,9 +230,9 @@ lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp)
res = getword(fp, word, sizeof(word));
if (strlen(word) == 0)
return (LWRES_R_FAILURE); /* nothing on line */
return (LWRES_R_FAILURE); /* Nothing on line. */
else if (res != EOF && res != '\n')
return (LWRES_R_FAILURE); /* extra junk on line */
return (LWRES_R_FAILURE); /* Extra junk on line. */
res = lwres_create_addr(word,
&confdata->nameservers[confdata->nsnext++]);
......@@ -249,8 +243,7 @@ lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp)
}
static lwres_result_t
lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp)
{
lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp) {
char word[LWRES_CONFMAXLINELEN];
int res, i;
lwres_conf_t *confdata;
......@@ -259,15 +252,17 @@ lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp)
res = getword(fp, word, sizeof(word));
if (strlen(word) == 0)
return (LWRES_R_FAILURE); /* nothing else on line */
return (LWRES_R_FAILURE); /* Nothing else on line. */
else if (res != EOF && res != '\n')
return (LWRES_R_FAILURE); /* extra junk on line */
return (LWRES_R_FAILURE); /* Extra junk on line. */
if (confdata->domainname != NULL)
CTXFREE(confdata->domainname,
strlen(confdata->domainname) + 1); /* */
/* search and domain are mutually exclusive */
/*
* Search and domain are mutually exclusive.
*/
for (i = 0 ; i < LWRES_CONFMAXSEARCH ; i++) {
if (confdata->search[i] != NULL) {
CTXFREE(confdata->search[i],
......@@ -286,8 +281,7 @@ lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp)
}
static lwres_result_t
lwres_conf_parsesearch(lwres_context_t *ctx, FILE *fp)
{
lwres_conf_parsesearch(lwres_context_t *ctx, FILE *fp) {
int idx, delim;
char word[LWRES_CONFMAXLINELEN];
lwres_conf_t *confdata;
......@@ -295,13 +289,17 @@ lwres_conf_parsesearch(lwres_context_t *ctx, FILE *fp)
confdata = &ctx->confdata;
if (confdata->domainname != NULL) {
/* search and domain are mutually exclusive */
/*
* Search and domain are mutually exclusive.
*/
CTXFREE(confdata->domainname,
strlen(confdata->domainname) + 1);
confdata->domainname = NULL;
}
/* remove any previous search definitions. */
/*
* Remove any previous search definitions.
*/
for (idx = 0 ; idx < LWRES_CONFMAXSEARCH ; idx++) {
if (confdata->search[idx] != NULL) {
CTXFREE(confdata->search[idx],
......@@ -313,12 +311,12 @@ lwres_conf_parsesearch(lwres_context_t *ctx, FILE *fp)
delim = getword(fp, word, sizeof(word));
if (strlen(word) == 0)
return (LWRES_R_FAILURE); /* nothing else on line */
return (LWRES_R_FAILURE); /* Nothing else on line. */
idx = 0;
while (strlen(word) > 0) {
if (confdata->searchnxt == LWRES_CONFMAXSEARCH)
return (LWRES_R_FAILURE); /* too many domains */
return (LWRES_R_FAILURE); /* Too many domains. */
confdata->search[idx] = lwres_strdup(ctx, word);
if