]> granicus.if.org Git - openssl/commitdiff
Fix ossl_param_bld_push_{utf8,octet}_string() / param_bld_convert()
authorRichard Levitte <levitte@openssl.org>
Wed, 21 Aug 2019 09:08:20 +0000 (11:08 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 21 Aug 2019 09:18:58 +0000 (11:18 +0200)
ossl_param_bld_push_{utf8,octet}_string() saved the constant string
pointer to a non-constant structure field, so we change that field to
a pointer to a constant.  We also modify param_bld_convert() to
pretend the resulting pointer for PTR types points to a constant as
well.

Completes #9649

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9651)

crypto/param_build.c
include/internal/param_build.h

index db2182196c85e69e4fe9dbaaf5d7878c2a3c1220..01866b01d970fe9966624d3ade571258e48e1711 100644 (file)
@@ -260,7 +260,7 @@ static OSSL_PARAM *param_bld_convert(OSSL_PARAM_BLD *bld, OSSL_PARAM *param,
         } else if (pd->type == OSSL_PARAM_OCTET_PTR
                    || pd->type == OSSL_PARAM_UTF8_PTR) {
             /* PTR */
-            *(void **)p = pd->string;
+            *(const void **)p = pd->string;
         } else if (pd->type == OSSL_PARAM_OCTET_STRING
                    || pd->type == OSSL_PARAM_UTF8_STRING) {
             if (pd->string != NULL)
index 83f808702056f9effb98eaed8d50efd1d09f1af5..bb96ba98e01c0ce1e5bd4042ff8774936f6e4191 100644 (file)
@@ -20,7 +20,7 @@ typedef struct {
     size_t size;
     size_t alloc_blocks;
     const BIGNUM *bn;
-    void *string;
+    const void *string;
     union {
         /*
          * These fields are never directly addressed, but their sizes are