Commit 2ddd3083 authored by Lev Walkin's avatar Lev Walkin

allowing null buffer

parent ed9019a9
...@@ -595,7 +595,7 @@ OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -595,7 +595,7 @@ OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
uint8_t *end; uint8_t *end;
size_t i; size_t i;
if(!st || !st->buf) if(!st || (!st->buf && st->size))
_ASN_ENCODE_FAILED; _ASN_ENCODE_FAILED;
er.encoded = 0; er.encoded = 0;
...@@ -751,7 +751,7 @@ OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -751,7 +751,7 @@ OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr,
(void)ilevel; /* Unused argument */ (void)ilevel; /* Unused argument */
(void)flags; /* Unused argument */ (void)flags; /* Unused argument */
if(!st || !st->buf) if(!st || (!st->buf && st->size))
_ASN_ENCODE_FAILED; _ASN_ENCODE_FAILED;
buf = st->buf; buf = st->buf;
...@@ -1433,7 +1433,7 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, ...@@ -1433,7 +1433,7 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td,
int squeeze = 0; int squeeze = 0;
int ret; int ret;
if(!st || !st->buf) if(!st || (!st->buf && st->size))
_ASN_ENCODE_FAILED; _ASN_ENCODE_FAILED;
if(unit_bits == 1) { if(unit_bits == 1) {
...@@ -1544,7 +1544,8 @@ OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, ...@@ -1544,7 +1544,8 @@ OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
(void)td; /* Unused argument */ (void)td; /* Unused argument */
if(!st || !st->buf) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0; if(!st || (!st->buf && st->size))
return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
/* /*
* Dump the contents of the buffer in hexadecimal. * Dump the contents of the buffer in hexadecimal.
...@@ -1580,7 +1581,7 @@ OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -1580,7 +1581,7 @@ OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr,
(void)td; /* Unused argument */ (void)td; /* Unused argument */
(void)ilevel; /* Unused argument */ (void)ilevel; /* Unused argument */
if(st && st->buf) { if(st && (st->buf || !st->size)) {
return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0;
} else { } else {
return (cb("<absent>", 8, app_key) < 0) ? -1 : 0; return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
...@@ -1604,6 +1605,7 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { ...@@ -1604,6 +1605,7 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
if(st->buf) { if(st->buf) {
FREEMEM(st->buf); FREEMEM(st->buf);
st->buf = 0;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment