This patch fixes several const qualifiers byu adding where required.
warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
Since glibc-2.43 and ISO C23, the functions bsearch, memchr, strchr,
strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr
that return pointers into their input arrays now have definitions as
macros that return a pointer to a const-qualified type when the input
argument is a pointer to a const-qualified type.
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Feb 25 11:04:09 2026
(Merged from https://github.com/openssl/openssl/pull/30136)
}
} else {
/* argument syntax error; do not reveal too much about arg */
- tmp = strchr(arg, ':');
- if (tmp == NULL || tmp - arg > PASS_SOURCE_SIZE_MAX)
+ const char *arg_ptr = strchr(arg, ':');
+ if (arg_ptr == NULL || arg_ptr - arg > PASS_SOURCE_SIZE_MAX)
BIO_printf(bio_err,
"Invalid password argument, missing ':' within the first %d chars\n",
PASS_SOURCE_SIZE_MAX + 1);
else
BIO_printf(bio_err,
"Invalid password argument, starting with \"%.*s\"\n",
- (int)(tmp - arg + 1), arg);
+ (int)(arg_ptr - arg + 1), arg);
return NULL;
}
}
CONF_MODULE *tmod;
int i;
size_t nchar;
- char *p;
+ const char *p;
STACK_OF(CONF_MODULE) *mods;
p = strrchr(name, '.');
return -1;
while (1) {
- char *tmpptr = strchr(inptr, '.');
+ const char *tmpptr = strchr(inptr, '.');
size_t delta = tmpptr != NULL ? (size_t)(tmpptr - inptr) : strlen(inptr);
if (!HAS_PREFIX(inptr, "xn--")) {
static int displaytext_get_tag_len(const char *tagstr)
{
- char *colon = strchr(tagstr, ':');
+ const char *colon = strchr(tagstr, ':');
return (colon == NULL) ? -1 : (int)(colon - tagstr);
}
static int do_othername(GENERAL_NAME *gen, const char *value, X509V3_CTX *ctx)
{
- char *objtmp = NULL, *p;
+ char *objtmp = NULL;
+ const char *p;
size_t objlen;
if ((p = strchr(value, ';')) == NULL)
ASN1_OCTET_STRING *ret = NULL;
unsigned char ipout[32];
char *iptmp = NULL, *p;
+ const char *slash;
int iplen1, iplen2;
- p = strchr(ipasc, '/');
- if (p == NULL)
+ slash = strchr(ipasc, '/');
+ if (slash == NULL)
return NULL;
iptmp = OPENSSL_strdup(ipasc);
if (iptmp == NULL)
return NULL;
- p = iptmp + (p - ipasc);
+ p = iptmp + (slash - ipasc);
*p++ = 0;
iplen1 = ossl_a2i_ipadd(ipout, iptmp);
int found_group = 0;
char etmp[GROUP_NAME_BUFFER_LENGTH];
int retval = 1; /* We assume success */
- char *current_prefix;
+ const char *current_prefix;
int ignore_unknown = 0;
int add_keyshare = 0;
int remove_group = 0;
static int pkey_add_control(EVP_TEST *t, STACK_OF(OPENSSL_STRING) *controls,
const char *value)
{
- char *p;
+ const char *p;
if (controls == NULL)
return 0;