2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

98_telnet.pm/01_FHEMWEB.pm: defend agains wide-charater crash (Forum #55421)

git-svn-id: https://svn.fhem.de/fhem/trunk@11772 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-07-09 11:36:03 +00:00
parent c99034bfa6
commit f4f610cf0f
2 changed files with 2 additions and 0 deletions

View File

@ -464,6 +464,7 @@ FW_Read($$)
($FW_httpheader{"Accept-Encoding"} &&
$FW_httpheader{"Accept-Encoding"} =~ m/gzip/) &&
$FW_use_zlib) {
utf8::encode($FW_RET) if(utf8::is_utf8($FW_RET));
eval { $FW_RET = Compress::Zlib::memGzip($FW_RET); };
if($@) {
Log 1, "memGzip: $@"; $FW_RET=""; #Forum #29939

View File

@ -316,6 +316,7 @@ telnet_Output($$$)
$ret = "$ret\n" if(!$hash->{showPrompt});
}
for(;;) {
utf8::encode($ret) if(utf8::is_utf8($ret));
my $l = syswrite($hash->{CD}, $ret);
last if(!$l || $l == length($ret));
$ret = substr($ret, $l);