--- a/hedgewars/uLocale.pas Fri Mar 10 11:42:25 2023 +0100
+++ b/hedgewars/uLocale.pas Tue Aug 22 08:35:46 2023 +0200
@@ -164,6 +164,10 @@
8: curArg:= arg9;
end;
+ // Replace % sign in argument with ASCII ESC
+ // to prevent infinite loop below.
+ ReplaceChars(curArg, '%', Char($1B));
+
repeat
p:= Pos('%'+IntToStr(i+1), tempstr);
if (p <> 0) then
@@ -173,6 +177,8 @@
end;
until (p = 0);
end;
+
+ReplaceChars(tempstr, Char($1B), '%');
Format:= tempstr;
end;
@@ -196,6 +202,10 @@
8: curArg:= arg9;
end;
+ // Replace % sign in argument with ASCII ESC
+ // to prevent infinite loop below.
+ ReplaceCharsA(curArg, '%', Char($1B));
+
repeat
p:= Pos('%'+IntToStr(i+1), tempstr);
if (p <> 0) then
@@ -205,6 +215,8 @@
end;
until (p = 0);
end;
+
+ReplaceCharsA(tempstr, Char($1B), '%');
FormatA:= tempstr;
end;