fix potential buffer overflow
authorsheepluva
Thu, 06 Feb 2014 22:13:30 +0100
changeset 10117 f6aa60d8a336
parent 10116 dd27562b6f21
child 10118 788703011d20
fix potential buffer overflow
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