* Sebastien Pouliot <sebastien@ximian.com>
*
* Copyright 2007-2010 Novell, Inc (http://www.novell.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <mono/metadata/class-internals.h>
{
char *type_name = mono_type_get_full_name (klass);
char *parent_name = mono_type_get_full_name (klass->parent);
- char *message = g_strdup_printf (format, type_name, parent_name);
+ char *message = mono_image_strdup_printf (klass->image, format, type_name, parent_name);
g_free (parent_name);
g_free (type_name);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
- mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
+ mono_class_set_type_load_failure (klass, "%s", message);
// note: do not free string given to mono_class_set_failure
}
{
char *method_name = get_method_full_name (override);
char *base_name = get_method_full_name (base);
- char *message = g_strdup_printf (format, method_name, base_name);
+ char *message = mono_image_strdup_printf (override->klass->image, format, method_name, base_name);
g_free (base_name);
g_free (method_name);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
- mono_class_set_failure (override->klass, MONO_EXCEPTION_TYPE_LOAD, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
+ mono_class_set_type_load_failure (override->klass, "%s", message);
// note: do not free string given to mono_class_set_failure
}
if (!klass->methods)
return NULL;
- for (i = 0; i < klass->method.count; ++i) {
+ int mcount = mono_class_get_method_count (klass);
+ for (i = 0; i < mcount; ++i) {
MonoMethodSignature *sig;
MonoMethod *method = klass->methods [i];
/* unlike most Invoke* cases InvokeMember is not inside System.Reflection[.Emit] but is SecuritySafeCritical */
if (((*kname == 'T') && (strcmp (kname, "Type") == 0)) ||
- ((*kname == 'M') && (strcmp (kname, "MonoType")) == 0)) {
+ ((*kname == 'R') && (strcmp (kname, "RuntimeType")) == 0)) {
/* if calling InvokeMember then we can't stop the stackwalk here and need to look at the caller */
if (strcmp (m->name, "InvokeMember") == 0)
g_free (callee_name);
g_free (caller_name);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
ex = mono_get_exception_argument ("method", message);
g_free (message);
g_free (field_name);
g_free (caller_name);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
ex = mono_get_exception_field_access_msg (message);
g_free (message);
g_free (callee_name);
g_free (caller_name);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
ex = mono_get_exception_method_access_msg (message);
g_free (message);
return TRUE;
}
-void
+gboolean
mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method, MonoError *error)
{
mono_error_init (error);