From 2db6c29a3ed37ec661e03c5ab23f2230dfd07d14 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 28 May 2023 20:21:05 +0000 Subject: [PATCH] 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 --- lib/krb5/mk_error.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/krb5/mk_error.c b/lib/krb5/mk_error.c index 7f0be713e..3791fe75a 100644 --- a/lib/krb5/mk_error.c +++ b/lib/krb5/mk_error.c @@ -76,8 +76,8 @@ krb5_mk_error_ext(krb5_context context, msg.realm = server->realm; msg.sname = server->name; }else{ - static char unspec[] = ""; - msg.realm = unspec; + static const char unspec[] = ""; + msg.realm = rk_UNCONST(unspec); } msg.crealm = rk_UNCONST(client_realm); msg.cname = rk_UNCONST(client_name);