]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] incorrect result code in isccc
authorEvan Hunt <each@isc.org>
Fri, 11 Sep 2015 07:04:25 +0000 (00:04 -0700)
committerEvan Hunt <each@isc.org>
Fri, 11 Sep 2015 07:04:25 +0000 (00:04 -0700)
4202. [bug] isccc_cc_fromwire() could return an incorrect
result. [RT #40614]

CHANGES
lib/isccc/cc.c
lib/isccc/sexpr.c

diff --git a/CHANGES b/CHANGES
index 882c4ac255c7d65307fb159ea4e50db6a017b532..aca3372dbf330273d76a7e8e085a575bea9fd7d9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
index 83027643d560af11a064b4714756cd74badd2c43..1a8f844d1c17a9034e5a87f28d29d86483ebcabc 100644 (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>
@@ -114,8 +112,7 @@ static isc_result_t
 list_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer);
 
 static isc_result_t
-value_towire(isccc_sexpr_t *elt, isc_buffer_t **buffer)
-{
+value_towire(isccc_sexpr_t *elt, isc_buffer_t **buffer) {
        unsigned int len;
        isccc_region_t *vr;
        isc_result_t result;
@@ -374,7 +371,8 @@ isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer,
                        unsigned char *hmac_alg;
 
                        hmac_size = (*buffer)->used + HSHA_OFFSET;
-                       hmac_alg = (unsigned char *) isc_buffer_used(*buffer) + HSHA_OFFSET - 1;
+                       hmac_alg = (unsigned char *) isc_buffer_used(*buffer) +
+                               HSHA_OFFSET - 1;
                        isc_buffer_putmem(*buffer,
                                          auth_hsha, sizeof(auth_hsha));
                        *hmac_alg = algorithm;
@@ -533,8 +531,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;
@@ -628,8 +625,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;
 
@@ -644,7 +640,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);
                }
        }
 
@@ -790,8 +786,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");
@@ -803,8 +798,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");
@@ -877,8 +871,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;
 
@@ -890,8 +883,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;
@@ -905,8 +897,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);
@@ -959,9 +950,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);
@@ -977,21 +966,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)
index 9b7d5d7f3749d317eccfacc2e3a580a957146a49..adf27bde79d63be21e06684d0a8285d430346131 100644 (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);
 }