Doubled length value and added check if both values are the same which is unlikely to happen for wrong or broken packages
Added unittest
Merge pull request #2733 from noctarius/fixed-utf8-buffer-overflow

Doubled length value and added check if both values are the same which i...