2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-22 18:07:25 +00:00

- Address static analysis warnings.

[ISC-Bugs #33510]
This commit is contained in:
Mark Andrews 2013-05-23 14:14:26 +10:00
parent dc9d7b08aa
commit d0a10f6ac3
8 changed files with 27 additions and 19 deletions

View File

@ -60,6 +60,9 @@ work on other platforms. Please report any problems and suggested fixes to
Changes since 4.2.5
- Address static analysis warnings.
[ISC-Bugs #33510]
- Silence benign static analysis warnings.
[ISC-Bugs #33428]

View File

@ -1,5 +1,5 @@
/*
* 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
@ -142,7 +142,7 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
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);

View File

@ -1,5 +1,5 @@
/*
* 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
@ -88,7 +88,7 @@ ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k,
u_char *cp = msg + *msglen, *eob = msg + msgsize;
u_char *lenp;
u_char *name, *alg;
unsigned n;
int n;
time_t timesigned;
dst_init();
@ -142,7 +142,7 @@ ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k,
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);
@ -190,8 +190,10 @@ ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k,
PUTSHORT(0, cp2); /* Top 16 bits of time */
PUTLONG(timesigned, cp2);
}
dst_sign_data(SIG_MODE_UPDATE, key, &ctx,
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);

View File

@ -1,5 +1,5 @@
/*
* 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
@ -148,13 +148,13 @@ ns_verify(u_char *msg, unsigned *msglen, void *k,
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;

View File

@ -3,7 +3,7 @@ static const char rcsid[] = "$Id: res_findzonecut.c,v 1.18 2009/11/24 02:06:57 s
#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
@ -296,7 +296,7 @@ get_soa(res_state statp, const char *dname, ns_class class,
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));
@ -591,7 +591,7 @@ do_query(res_state statp, const char *dname, ns_class class, ns_type qtype,
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;
}

View File

@ -52,7 +52,7 @@
*/
/*
* 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
@ -139,8 +139,9 @@ res_nmkquery(res_state statp,
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;
@ -155,6 +156,8 @@ res_nmkquery(res_state statp,
/*
* 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)

View File

@ -1,5 +1,5 @@
/*
* 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
@ -108,7 +108,7 @@ res_nmkupdate(res_state statp,
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;

View File

@ -3,7 +3,7 @@ static const char rcsid[] = "$Id: res_update.c,v 1.17 2009/11/24 02:06:57 sar Ex
#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
@ -180,7 +180,7 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in) {
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)