# HG changeset patch
# User sheepluva
# Date 1391721210 -3600
# Node ID f6aa60d8a33657b25bc190de2a5581bcdfc99f69
# Parent  dd27562b6f2102e667009c791e47c550fb378e3e
fix potential buffer overflow

diff -r dd27562b6f21 -r f6aa60d8a336 hedgewars/uUtils.pas
--- a/hedgewars/uUtils.pas	Thu Feb 06 22:03:53 2014 +0100
+++ b/hedgewars/uUtils.pas	Thu Feb 06 22:13:30 2014 +0100
@@ -377,7 +377,7 @@
 {$ENDIF}
     exit;
 
-l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), length(s))-1;
+l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), min(length(tmpstr), length(s)))-1;
 i:= 0;
 
 while i < l do