aboutsummaryrefslogtreecommitdiffstats
path: root/packet-dns.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-12-11 18:38:57 +0000
committerGuy Harris <guy@alum.mit.edu>2003-12-11 18:38:57 +0000
commit95ea01a41ad9ca8a1b3514c1bef8a69141721bf0 (patch)
tree05ffafb7a523d777231c5d6d086e3c87dfb7d8cd /packet-dns.c
parentd4edb00a3a32d2b5b25e85e0d5e2a6bf6d6fb607 (diff)
Have "compute_key_id()" return different values for different errors,
and have its caller put an entry into the tree for "we don't support the algorithm" (the "RR too short" error is a "can't happen"). svn path=/trunk/; revision=9243
Diffstat (limited to 'packet-dns.c')
-rw-r--r--packet-dns.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/packet-dns.c b/packet-dns.c
index a7d0a016fc..4dae492ed1 100644
--- a/packet-dns.c
+++ b/packet-dns.c
@@ -1,7 +1,7 @@
/* packet-dns.c
* Routines for DNS packet disassembly
*
- * $Id: packet-dns.c,v 1.108 2003/12/11 08:54:19 ulfl Exp $
+ * $Id: packet-dns.c,v 1.109 2003/12/11 18:38:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -890,8 +890,8 @@ static const value_string cert_vals[] = {
/**
* Compute the key id of a KEY RR depending of the algorithm used.
- * If the specified size is bad, or we don't support the algorithm,
- * return -1.
+ * If the specified size is bad, return -1.
+ * If we don't support the algorithm, return -2.
*/
static int
compute_key_id(tvbuff_t *tvb, int offset, int size, guint8 algo)
@@ -919,7 +919,7 @@ compute_key_id(tvbuff_t *tvb, int offset, int size, guint8 algo)
ac += (ac >> 16) & 0xffff;
return (ac & 0xffff);
default:
- return -1;
+ return -2;
}
}
@@ -1367,10 +1367,15 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
proto_tree_add_text(rr_tree, tvb, cur_offset, 1, "Algorithm: %s",
val_to_str(algo, algo_vals, "Unknown (0x%02X)"));
cur_offset += 1;
- rr_len -= 1;
+ rr_len -= 1;
key_id = compute_key_id(tvb, cur_offset-4, rr_len+4, algo);
- if (key_id != -1)
+ /* XXX - -1 "can't happen", as rr_len should be >= 0; however,
+ none of the RR dissectors check rr_len as we process the
+ RR. */
+ if (key_id == -2)
+ proto_tree_add_text(rr_tree, tvb, cur_offset-4, rr_len+4, "Key id: Unknown (algorithm 0x%02X not supported)", algo);
+ else
proto_tree_add_text(rr_tree, tvb, cur_offset-4, rr_len+4, "Key id: %d", key_id);
proto_tree_add_text(rr_tree, tvb, cur_offset, rr_len, "Public key");
}