per_support: Fix bit error in encoding process
Thanks to Dieter Spaar for finding and fixing this !
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 @@
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);
}