summaryrefslogtreecommitdiff
path: root/source4/libcli/util
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-08-31 06:21:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:26 -0500
commit776d90d801ee253157f9de90416a93bfc7bfd55e (patch)
tree7d67d30a1a1726ecf9c86ac0a050e4b5aaf64068 /source4/libcli/util
parenteed08c84e28d518a5225bbf63815db6a4a50e0a5 (diff)
downloadsamba-776d90d801ee253157f9de90416a93bfc7bfd55e.tar.gz
samba-776d90d801ee253157f9de90416a93bfc7bfd55e.tar.bz2
samba-776d90d801ee253157f9de90416a93bfc7bfd55e.zip
r2122: merge from trunk (-r 2120):
Fix bug found by Love H?\195?\182rnquist ?\195?\133strand: asn1_write_Integer needs to push stuff little endian. (This used to be commit 79bee828fbb70e71ad3fbd45758bcc7775ea977b)
Diffstat (limited to 'source4/libcli/util')
-rw-r--r--source4/libcli/util/asn1.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c
index 6f613f398b..756a33f77d 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/libcli/util/asn1.c
@@ -107,15 +107,23 @@ BOOL asn1_pop_tag(ASN1_DATA *data)
return True;
}
+static void push_int_littleendian(ASN1_DATA *data, int i)
+{
+ uint8_t lowest = i & 0xFF;
+
+ i = i >> 8;
+ if (i != 0)
+ push_int_littleendian(data, i);
+
+ asn1_write_uint8(data, lowest);
+}
+
/* write an integer */
BOOL asn1_write_Integer(ASN1_DATA *data, int i)
{
if (!asn1_push_tag(data, ASN1_INTEGER)) return False;
- do {
- asn1_write_uint8(data, i);
- i = i >> 8;
- } while (i);
+ push_int_littleendian(data, i);
return asn1_pop_tag(data);
}