[v9_9] incorrect result code in isccc

4202.	[bug]		isccc_cc_fromwire() could return an incorrect
			result. [RT #40614]
This commit is contained in:
Evan Hunt 2015-09-11 00:05:44 -07:00
parent 33eddc9bc0
commit f4e2fb819d
3 changed files with 34 additions and 66 deletions

View file

@ -1,3 +1,6 @@
4202. [bug] isccc_cc_fromwire() could return an incorrect
result. [RT #40614]
4201. [func] The default preferred-glue is now the address record
type of the transport the query was received
over. [RT #40468]

View file

@ -29,8 +29,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cc.c,v 1.18 2007/08/28 07:20:43 tbox Exp $ */
/*! \file */
#include <config.h>
@ -85,8 +83,7 @@ static isc_result_t
list_towire(isccc_sexpr_t *alist, isccc_region_t *target);
static isc_result_t
value_towire(isccc_sexpr_t *elt, isccc_region_t *target)
{
value_towire(isccc_sexpr_t *elt, isccc_region_t *target) {
unsigned int len;
unsigned char *lenp;
isccc_region_t *vr;
@ -328,8 +325,7 @@ static isc_result_t
list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp);
static isc_result_t
value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep)
{
value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) {
unsigned int msgtype;
isc_uint32_t len;
isccc_sexpr_t *value;
@ -423,8 +419,7 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret,
}
static isc_result_t
list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp)
{
list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp) {
isccc_sexpr_t *list, *value;
isc_result_t result;
@ -439,7 +434,7 @@ list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp)
if (isccc_sexpr_addtolist(&list, value) == NULL) {
isccc_sexpr_free(&value);
isccc_sexpr_free(&list);
return (result);
return (ISC_R_NOMEMORY);
}
}
@ -585,8 +580,7 @@ isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok,
}
isc_boolean_t
isccc_cc_isack(isccc_sexpr_t *message)
{
isccc_cc_isack(isccc_sexpr_t *message) {
isccc_sexpr_t *_ctrl;
_ctrl = isccc_alist_lookup(message, "_ctrl");
@ -598,8 +592,7 @@ isccc_cc_isack(isccc_sexpr_t *message)
}
isc_boolean_t
isccc_cc_isreply(isccc_sexpr_t *message)
{
isccc_cc_isreply(isccc_sexpr_t *message) {
isccc_sexpr_t *_ctrl;
_ctrl = isccc_alist_lookup(message, "_ctrl");
@ -672,8 +665,7 @@ isccc_cc_createresponse(isccc_sexpr_t *message, isccc_time_t now,
}
isccc_sexpr_t *
isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str)
{
isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str) {
size_t len;
isccc_region_t r;
@ -685,8 +677,7 @@ isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str)
}
isccc_sexpr_t *
isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i)
{
isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i) {
char b[100];
size_t len;
isccc_region_t r;
@ -700,8 +691,7 @@ isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i)
}
isc_result_t
isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp)
{
isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp) {
isccc_sexpr_t *kv, *v;
REQUIRE(strp == NULL || *strp == NULL);
@ -754,9 +744,7 @@ symtab_undefine(char *key, unsigned int type, isccc_symvalue_t value,
}
static isc_boolean_t
symtab_clean(char *key, unsigned int type, isccc_symvalue_t value,
void *arg)
{
symtab_clean(char *key, unsigned int type, isccc_symvalue_t value, void *arg) {
isccc_time_t *now;
UNUSED(key);
@ -772,21 +760,18 @@ symtab_clean(char *key, unsigned int type, isccc_symvalue_t value,
}
isc_result_t
isccc_cc_createsymtab(isccc_symtab_t **symtabp)
{
isccc_cc_createsymtab(isccc_symtab_t **symtabp) {
return (isccc_symtab_create(11897, symtab_undefine, NULL, ISC_FALSE,
symtabp));
}
void
isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now)
{
isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now) {
isccc_symtab_foreach(symtab, symtab_clean, &now);
}
static isc_boolean_t
has_whitespace(const char *str)
{
has_whitespace(const char *str) {
char c;
if (str == NULL)

View file

@ -29,8 +29,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sexpr.c,v 1.9 2007/08/28 07:20:43 tbox Exp $ */
/*! \file */
#include <config.h>
@ -50,8 +48,7 @@ static isccc_sexpr_t sexpr_t = { ISCCC_SEXPRTYPE_T, { NULL } };
#define CDR(s) (s)->value.as_dottedpair.cdr
isccc_sexpr_t *
isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr)
{
isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr) {
isccc_sexpr_t *sexpr;
sexpr = malloc(sizeof(*sexpr));
@ -65,14 +62,12 @@ isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr)
}
isccc_sexpr_t *
isccc_sexpr_tconst(void)
{
isccc_sexpr_tconst(void) {
return (&sexpr_t);
}
isccc_sexpr_t *
isccc_sexpr_fromstring(const char *str)
{
isccc_sexpr_fromstring(const char *str) {
isccc_sexpr_t *sexpr;
sexpr = malloc(sizeof(*sexpr));
@ -89,8 +84,7 @@ isccc_sexpr_fromstring(const char *str)
}
isccc_sexpr_t *
isccc_sexpr_frombinary(const isccc_region_t *region)
{
isccc_sexpr_frombinary(const isccc_region_t *region) {
isccc_sexpr_t *sexpr;
unsigned int region_size;
@ -123,8 +117,7 @@ isccc_sexpr_frombinary(const isccc_region_t *region)
}
void
isccc_sexpr_free(isccc_sexpr_t **sexprp)
{
isccc_sexpr_free(isccc_sexpr_t **sexprp) {
isccc_sexpr_t *sexpr;
isccc_sexpr_t *item;
@ -153,8 +146,7 @@ isccc_sexpr_free(isccc_sexpr_t **sexprp)
}
static isc_boolean_t
printable(isccc_region_t *r)
{
printable(isccc_region_t *r) {
unsigned char *curr;
curr = r->rstart;
@ -168,8 +160,7 @@ printable(isccc_region_t *r)
}
void
isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream)
{
isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream) {
isccc_sexpr_t *cdr;
unsigned int size, i;
unsigned char *curr;
@ -220,40 +211,35 @@ isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream)
}
isccc_sexpr_t *
isccc_sexpr_car(isccc_sexpr_t *list)
{
isccc_sexpr_car(isccc_sexpr_t *list) {
REQUIRE(list->type == ISCCC_SEXPRTYPE_DOTTEDPAIR);
return (CAR(list));
}
isccc_sexpr_t *
isccc_sexpr_cdr(isccc_sexpr_t *list)
{
isccc_sexpr_cdr(isccc_sexpr_t *list) {
REQUIRE(list->type == ISCCC_SEXPRTYPE_DOTTEDPAIR);
return (CDR(list));
}
void
isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car)
{
isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car) {
REQUIRE(pair->type == ISCCC_SEXPRTYPE_DOTTEDPAIR);
CAR(pair) = car;
}
void
isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr)
{
isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr) {
REQUIRE(pair->type == ISCCC_SEXPRTYPE_DOTTEDPAIR);
CDR(pair) = cdr;
}
isccc_sexpr_t *
isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2)
{
isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2) {
isccc_sexpr_t *last, *elt, *l1;
REQUIRE(l1p != NULL);
@ -275,40 +261,35 @@ isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2)
}
isc_boolean_t
isccc_sexpr_listp(isccc_sexpr_t *sexpr)
{
isccc_sexpr_listp(isccc_sexpr_t *sexpr) {
if (sexpr == NULL || sexpr->type == ISCCC_SEXPRTYPE_DOTTEDPAIR)
return (ISC_TRUE);
return (ISC_FALSE);
}
isc_boolean_t
isccc_sexpr_emptyp(isccc_sexpr_t *sexpr)
{
isccc_sexpr_emptyp(isccc_sexpr_t *sexpr) {
if (sexpr == NULL)
return (ISC_TRUE);
return (ISC_FALSE);
}
isc_boolean_t
isccc_sexpr_stringp(isccc_sexpr_t *sexpr)
{
isccc_sexpr_stringp(isccc_sexpr_t *sexpr) {
if (sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_STRING)
return (ISC_TRUE);
return (ISC_FALSE);
}
isc_boolean_t
isccc_sexpr_binaryp(isccc_sexpr_t *sexpr)
{
isccc_sexpr_binaryp(isccc_sexpr_t *sexpr) {
if (sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_BINARY)
return (ISC_TRUE);
return (ISC_FALSE);
}
char *
isccc_sexpr_tostring(isccc_sexpr_t *sexpr)
{
isccc_sexpr_tostring(isccc_sexpr_t *sexpr) {
REQUIRE(sexpr != NULL &&
(sexpr->type == ISCCC_SEXPRTYPE_STRING ||
sexpr->type == ISCCC_SEXPRTYPE_BINARY));
@ -319,8 +300,7 @@ isccc_sexpr_tostring(isccc_sexpr_t *sexpr)
}
isccc_region_t *
isccc_sexpr_tobinary(isccc_sexpr_t *sexpr)
{
isccc_sexpr_tobinary(isccc_sexpr_t *sexpr) {
REQUIRE(sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_BINARY);
return (&sexpr->value.as_region);
}