krb5/mk_error.c: Constify and rk_UNCONST a static buffer.

This is almost certainly intended never to be written to, so let's
let the operating system detect that mistake for us by mapping it in
a .rodata segment mapped read-only that will cause SIGSEGV on write.

fix https://github.com/heimdal/heimdal/issues/1136
This commit is contained in:
Taylor R Campbell
2023-05-28 20:21:05 +00:00
committed by Nico Williams
parent ca1200df03
commit 2db6c29a3e

View File

@@ -76,8 +76,8 @@ krb5_mk_error_ext(krb5_context context,
msg.realm = server->realm;
msg.sname = server->name;
}else{
static char unspec[] = "<unspecified realm>";
msg.realm = unspec;
static const char unspec[] = "<unspecified realm>";
msg.realm = rk_UNCONST(unspec);
}
msg.crealm = rk_UNCONST(client_realm);
msg.cname = rk_UNCONST(client_name);