asn1: Fix braino in asn1_print

This commit is contained in:
Nicolas Williams
2021-03-05 14:06:17 -06:00
parent 7bc02e5d5f
commit 2035efe765

View File

@@ -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))