From e4bf569ad33ddc0459769eb1fa1e0113bb83899d Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sat, 2 Apr 2011 14:23:30 +0200 Subject: [PATCH] strlen to mb_strlen with ASCII charset to avoid binary string wrong length calculation --- web/Obj/brisk.phh | 4 ++-- web/briskin5/Obj/briskin5.phh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 8b0e8e4..fa53c62 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -858,7 +858,7 @@ class User { break; if (($s = fread($fp, 8)) == FALSE) break; - if (strlen($s) != 8) + if (mb_strlen($s, "ASCII") != 8) break; $arr = unpack('Ls/Li', $s); fclose($fp); @@ -2494,7 +2494,7 @@ class Room { break; if (($s = fread($fp, 4)) == FALSE) break; - if (strlen($s) != 4) + if (mb_strlen($s, "ASCII") != 4) break; $arr = unpack('Le', $s); if ($arr['e'] > $tm) diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index eef465f..718fabd 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -533,7 +533,7 @@ class Bin5_user extends User { break; if (($s = fread($fp, 8)) == FALSE) break; - if (strlen($s) != 8) + if (mb_strlen($s, "ASCII") != 8) break; $arr = unpack('Ls/Li', $s); fclose($fp); @@ -1158,7 +1158,7 @@ class Bin5 { break; if (($s = fread($fp, 4)) == FALSE) break; - if (strlen($s) != 4) + if (mb_strlen($s, "ASCII") != 4) break; $arr = unpack('Le', $s); if ($arr['e'] > $tm) -- 2.17.1