aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asn1.c24
-rw-r--r--asn1.h6
2 files changed, 16 insertions, 14 deletions
diff --git a/asn1.c b/asn1.c
index afe18c8c59..1202eabd0f 100644
--- a/asn1.c
+++ b/asn1.c
@@ -1,7 +1,7 @@
/* asn1.c
* Routines for ASN.1 BER dissection
*
- * $Id: asn1.c,v 1.17 2002/08/28 21:00:05 jmayer Exp $
+ * $Id: asn1.c,v 1.18 2003/04/28 00:31:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -592,35 +592,37 @@ done:
* )
* DESCRIPTION: Decodes Bit String.
* Parameters:
- * asn1: pointer to ASN1 socket.
- * eoc: offset of end of encoding, or -1 if indefinite.
- * bits: pointer to begin of Bit String.
- * size: Size of Bit String in characters.
- * len: Length of Bit String in characters.
- * unused: Number of unused bits in last character.
+ * asn1: pointer to ASN1 socket.
+ * enc_len: length of value.
+ * bits: pointer to variable we set to point to strring
+ * len: Size of Bit String in characters.
+ * unused: Number of unused bits in last character.
* RETURNS: ASN1_ERR value (ASN1_ERR_NOERROR on success)
*/
int
-asn1_bits_decode ( ASN1_SCK *asn1, int eoc, guchar **bits,
+asn1_bits_decode ( ASN1_SCK *asn1, int enc_len, guchar **bits,
guint *len, guchar *unused)
-
{
int ret;
+ int eoc;
+ guchar *ptr;
+ eoc = asn1->offset + enc_len;
*bits = NULL;
ret = asn1_octet_decode (asn1, unused);
if (ret != ASN1_ERR_NOERROR)
return ret;
*len = 0;
- *bits = g_malloc(eoc - asn1->offset);
+ ptr = *bits = g_malloc(enc_len);
while (asn1->offset < eoc) {
- ret = asn1_octet_decode (asn1, (guchar *)bits++);
+ ret = asn1_octet_decode (asn1, (guchar *)ptr++);
if (ret != ASN1_ERR_NOERROR) {
g_free(*bits);
*bits = NULL;
return ret;
}
}
+ *len = ptr - *bits;
return ASN1_ERR_NOERROR;
}
diff --git a/asn1.h b/asn1.h
index 865fda249d..22f78f15aa 100644
--- a/asn1.h
+++ b/asn1.h
@@ -1,7 +1,7 @@
/* asn1.h
* Definitions for ASN.1 BER dissection
*
- * $Id: asn1.h,v 1.12 2003/04/25 05:39:33 guy Exp $
+ * $Id: asn1.h,v 1.13 2003/04/28 00:31:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -129,8 +129,8 @@ extern int asn1_int32_decode (ASN1_SCK *asn1, gint32 *integer, guint *nbytes);
extern int asn1_uint32_value_decode (ASN1_SCK *asn1, int enc_len,
guint *integer);
extern int asn1_uint32_decode (ASN1_SCK *asn1, guint32 *integer, guint *nbytes);
-extern int asn1_bits_decode (ASN1_SCK *asn1, int eoc, guchar **bits,
- guint *len, guchar *unused);
+extern int asn1_bits_decode (ASN1_SCK *asn1, int enc_len, guchar **bits,
+ guint *len, guchar *unused);
extern int asn1_string_value_decode (ASN1_SCK *asn1, int enc_len,
guchar **octets);
extern int asn1_string_decode (ASN1_SCK *asn1, guchar **octets, guint *str_len,