File openssl-0001-opt_init.patch of Package openssl-3

Description: Fix CWE-476 (NULL Pointer Dereference) in opt_init
Issue: The pointer 'o' (OPTIONS) might be NULL when passed to opt_init, but it is dereferenced in the loop condition without a prior check. This patch adds a guard clause.

Index: openssl-3.6.0/apps/lib/opt.c
===================================================================
--- openssl-3.6.0.orig/apps/lib/opt.c
+++ openssl-3.6.0/apps/lib/opt.c
@@ -167,6 +167,10 @@ char *opt_init(int ac, char **av, const
     opt_begin();
     opts = o;
     unknown = NULL;
+
+    if (o == NULL)
+        return NULL;
+
     /* Make sure prog name is set for usage output */
     (void)opt_progname(argv[0]);
 
openSUSE Build Service is sponsored by