From d7d3ed8a5e314024ee99033d41a80273790abec8 Mon Sep 17 00:00:00 2001 From: v0-e Date: Fri, 1 Dec 2023 11:31:59 +0000 Subject: [PATCH] jer: OCTET STRING allow empty --- skeletons/OCTET_STRING_jer.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/skeletons/OCTET_STRING_jer.c b/skeletons/OCTET_STRING_jer.c index 035193850..3842e7fff 100644 --- a/skeletons/OCTET_STRING_jer.c +++ b/skeletons/OCTET_STRING_jer.c @@ -200,19 +200,18 @@ static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_b int half = 0; /* Half bit */ uint8_t *buf; + /* Strip quotes */ for (; p < pend; ++p) { - if (*p == CQUOTE) + if (*p == CQUOTE) { + ++p; break; + } } - ++p; - - for (; pend > p; --pend) { + for (; pend >= p; --pend) { if (*pend == CQUOTE) break; } - - if (pend - p < 2) return -1; - + if (pend - p < 0) return -1; chunk_size = pend - p; /* Reallocate buffer according to high cap estimation */