From 36e9222c42ff74a71ea4e52150285e2264ad4dd0 Mon Sep 17 00:00:00 2001 From: z2_ <88509734+z2-2z@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:57:07 +0200 Subject: [PATCH] x509asn1: prevent NULL dereference Closes #13978 --- lib/vtls/x509asn1.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/vtls/x509asn1.c b/lib/vtls/x509asn1.c index c896838de7..f71ab0b90a 100644 --- a/lib/vtls/x509asn1.c +++ b/lib/vtls/x509asn1.c @@ -695,6 +695,11 @@ static CURLcode encodeDN(struct dynbuf *store, struct Curl_asn1Element *dn) str = Curl_dyn_ptr(&temp); + if(!str) { + result = CURLE_BAD_FUNCTION_ARGUMENT; + goto error; + } + /* Encode delimiter. If attribute has a short uppercase name, delimiter is ", ". */ for(p3 = str; ISUPPER(*p3); p3++) -- 2.47.3