diff --git a/lib/asn1/asn1_print.c b/lib/asn1/asn1_print.c index 7f1599bcc..693343840 100644 --- a/lib/asn1/asn1_print.c +++ b/lib/asn1/asn1_print.c @@ -434,7 +434,7 @@ dotype(unsigned char *buf, size_t len, char **argv, size_t *size) if (wants != sz) errx(1, "Encoding will not round trip"); - ret = sorted_types[i].encode(der, sz, v, &sz); + ret = sorted_types[i].encode(der + (sz - 1), sz, v, &sz); if (ret != 0) errx(1, "Encoding failed"); if (memcmp(buf, der, sz)) @@ -452,7 +452,7 @@ dotype(unsigned char *buf, size_t len, char **argv, size_t *size) if (wants != sz) errx(1, "Encoding of copy will not round trip"); - ret = sorted_types[i].encode(der, sz, vcpy, &sz); + ret = sorted_types[i].encode(der + (sz - 1), sz, vcpy, &sz); if (ret != 0) errx(1, "Encoding of copy failed"); if (memcmp(buf, der, sz))