From 7d28f60b6114800a771da18bd729c8ba9d2e8bfb Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 11 Dec 2019 10:52:19 +0100 Subject: [PATCH] [runtime] Don't zero-terminate after the string buffer. Fixes #7564. Fixes https://github.com/xamarin/xamarin-macios/issues/7564. --- runtime/trampolines.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/trampolines.m b/runtime/trampolines.m index a45907ab91e8..97cab357290f 100644 --- a/runtime/trampolines.m +++ b/runtime/trampolines.m @@ -438,6 +438,12 @@ type++; } + if (c == max_char) { + LOGZ (" xamarin_collapse_struct_name (%s, %i) => failed (too long)!\n", input, max_char); + struct_name [0] = 0; // return an empty string + return false; + } + struct_name [c] = 0; // Zero-terminate. LOGZ (" xamarin_collapse_struct_name (%s, %i) => %s (succeeded)\n", input, max_char, struct_name); return true;