Skip to content

Commit

Permalink
Specify charset explicitly on getBytes
Browse files Browse the repository at this point in the history
  • Loading branch information
aikar committed Nov 17, 2018
1 parent d540836 commit aae0c12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Spigot-Server-Patches/0410-Book-Size-Limits.patch
Expand Up @@ -39,7 +39,7 @@ index 3427e95e60..462ab49762 100644
+ long byteAllowed = maxBookPageSize;
+ for (int i = 0; i < pageList.size(); ++i) {
+ String testString = pageList.getString(i);
+ int byteLength = testString.getBytes().length;
+ int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
+ byteTotal += byteLength;
+ if (byteTotal > byteAllowed) {
+ PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
Expand Down

0 comments on commit aae0c12

Please sign in to comment.