summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-06-14 23:36:29 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-20 00:11:06 +0200
commitee1a5c9ae37bd4d3b64444a292425bdd3da564f4 (patch)
treecd3c217320038c60e5a6a300cde71d54deb2f84b
parent64fdc4cb06c1b89b2b3aa2ae01c92248292262f0 (diff)
per_support: Fix bit error in encoding process
Thanks to Dieter Spaar for finding and fixing this !
-rw-r--r--src/per_support.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/per_support.c b/src/per_support.c
index e8299c7..173e696 100644
--- a/src/per_support.c
+++ b/src/per_support.c
@@ -336,7 +336,8 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
buf[3] = bits;
else {
ASN_DEBUG("->[PER out split %d]", obits);
- per_put_few_bits(po, bits >> 8, 24);
+ po->nboff -= obits; /* undo incrementation from a few lines above */
+ per_put_few_bits(po, bits >> (obits - 24), 24); /* shift according to the rest of the bits */
per_put_few_bits(po, bits, obits - 24);
ASN_DEBUG("<-[PER out split %d]", obits);
}