Changes since 4.2.5
+- Address static analysis warnings.
+ [ISC-Bugs #33510]
+
- Silence benign static analysis warnings.
[ISC-Bugs #33428]
/*
- * Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
isc_result_t status;
/* Make section right. */
- if (section < 0 || section >= ns_s_max)
+ if (section >= ns_s_max)
return ISC_R_NOTIMPLEMENTED;
if (section != handle->_sect)
setsection(handle, section);
/*
- * Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
u_char *cp = msg + *msglen, *eob = msg + msgsize;
u_char *lenp;
u_char *name, *alg;
- unsigned n;
+ int n;
time_t timesigned;
dst_init();
if (key != NULL && error != ns_r_badsig && error != ns_r_badkey) {
void *ctx;
u_char buf[MAXDNAME], *cp2;
- unsigned n;
+ int n;
dst_sign_data(SIG_MODE_INIT, key, &ctx, NULL, 0, NULL, 0);
PUTSHORT(0, cp2); /* Top 16 bits of time */
PUTLONG(timesigned, cp2);
}
- dst_sign_data(SIG_MODE_UPDATE, key, &ctx,
- buf, (unsigned)(cp2-buf), NULL, 0);
+ n = dst_sign_data(SIG_MODE_UPDATE, key, &ctx,
+ buf, (unsigned)(cp2-buf), NULL, 0);
+ if (n < 0)
+ return ISC_R_BADKEY;
n = dst_sign_data(SIG_MODE_FINAL, key, &ctx, NULL, 0,
sig, *siglen);
/*
- * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2007,2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
char name[MAXDNAME], alg[MAXDNAME];
u_char *recstart, *rdatastart;
u_char *sigstart, *otherstart;
- unsigned n;
+ int n;
int error;
u_int16_t type, length;
u_int16_t fudge, sigfieldlen, id, otherfieldlen;
dst_init();
- if (msg == NULL || msglen == NULL || *msglen < 0)
+ if (msg == NULL || msglen == NULL)
return ISC_R_INVALIDARG;
eom = msg + *msglen;
#endif /* not lint */
/*
- * Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
int rdlen;
ns_rr rr;
- rcode = ns_parserr(&msg, sect, i, &rr) < 0;
+ rcode = ns_parserr(&msg, sect, i, &rr);
if (rcode != ISC_R_SUCCESS) {
DPRINTF(("get_soa: ns_parserr(%s, %d) failed",
p_section(sect, ns_o_query), i));
DPRINTF(("do_query: res_nsend returned 0"));
return ISC_R_NOTFOUND;
}
- if (ns_initparse((u_char *)resp, n, msg) < 0) {
+ if (ns_initparse((u_char *)resp, n, msg) != ISC_R_SUCCESS) {
DPRINTF(("do_query: ns_initparse failed"));
return ISC_R_NOSPACE;
}
*/
/*
- * Portions Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 2004,2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
switch (op) {
case QUERY: /*FALLTHROUGH*/
case NS_NOTIFY_OP:
- if ((buflen -= QFIXEDSZ) < 0)
+ if (buflen < QFIXEDSZ )
return ISC_R_NOSPACE;
+ buflen -= QFIXEDSZ;
if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
return ISC_R_NOSPACE;
cp += n;
/*
* Make an additional record for completion domain.
*/
+ if (buflen < RRFIXEDSZ)
+ return ISC_R_NOSPACE;
buflen -= RRFIXEDSZ;
n = dn_comp((const char *)data, cp, buflen, dnptrs, lastdnptr);
if (n < 0)
/*
- * Copyright (c) 2004,2007-2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2007-2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
u_int16_t rtype, rclass;
u_int32_t n1, rttl;
u_char *dnptrs[20], **dpp, **lastdnptr;
- unsigned certlen;
+ int certlen;
int keylen;
unsigned buflen = *blp;
u_char *buf = (unsigned char *)bp;
#endif /* not lint */
/*
- * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2007,2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
undone:
/* Restore resolver's nameserver set. */
statp->nscount = nscopy(statp->nsaddr_list, nsaddrs, nscount);
- nscount = 0;
+
done:
if (zptr) {
if ((zptr->z_flags & ZG_F_ZONESECTADDED) != 0)