neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libasn1c/+/37985?usp=email )


Change subject: coverity CID#27224
......................................................................

coverity CID#27224

prevent st->buf == NULL dereference.

Change-Id: I6760be87dfa5281d79f6ebfb749b09179192ba3c
---
M src/OCTET_STRING.c
1 file changed, 3 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libasn1c refs/changes/85/37985/1

diff --git a/src/OCTET_STRING.c b/src/OCTET_STRING.c
index 9d2e817..959c32e 100644
--- a/src/OCTET_STRING.c
+++ b/src/OCTET_STRING.c
@@ -1798,10 +1798,11 @@
                        ret = OCTET_STRING_per_put_characters(po, st->buf,
                                sizeinunits, bpc, unit_bits,
                                cval->lower_bound, cval->upper_bound, pc);
-               } else {
+               } else if (st->buf) {
                        ret = per_put_many_bits(po, st->buf,
                                sizeinunits * unit_bits);
-               }
+               } else
+                       _ASN_ENCODE_FAILED;
                if(ret) _ASN_ENCODE_FAILED;
                _ASN_ENCODED_OK(er);
        }

--
To view, visit https://gerrit.osmocom.org/c/libasn1c/+/37985?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: libasn1c
Gerrit-Branch: master
Gerrit-Change-Id: I6760be87dfa5281d79f6ebfb749b09179192ba3c
Gerrit-Change-Number: 37985
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>

Reply via email to