diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-08-31 06:21:14 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:26 -0500 |
commit | 776d90d801ee253157f9de90416a93bfc7bfd55e (patch) | |
tree | 7d67d30a1a1726ecf9c86ac0a050e4b5aaf64068 /source4 | |
parent | eed08c84e28d518a5225bbf63815db6a4a50e0a5 (diff) | |
download | samba-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')
-rw-r--r-- | source4/libcli/util/asn1.c | 16 |
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); } |