]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/tls: fix null deref with subjectaltname
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 3 Sep 2025 20:07:27 +0000 (22:07 +0200)
committerVictor Julien <vjulien@oisf.net>
Sun, 14 Sep 2025 14:12:59 +0000 (16:12 +0200)
Ticket: 7881

src/detect-tls-subjectaltname.c

index 8ddb68f1b13bbaa4203be91cfdaf3fd87f00b8fc..ee3800e481135e8a6a4272e717a9653cbdf8a846 100644 (file)
@@ -68,7 +68,12 @@ static bool TlsSubjectAltNameGetData(DetectEngineThreadCtx *det_ctx, const void
     }
 
     *buf = (const uint8_t *)connp->cert0_sans[idx];
-    *buf_len = (uint32_t)strlen(connp->cert0_sans[idx]);
+    if (*buf) {
+        *buf_len = (uint32_t)strlen(connp->cert0_sans[idx]);
+    } else {
+        // happens if the altname had a zero character in it
+        *buf_len = 0;
+    }
     return true;
 }