File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/com/rabbitmq/client/impl Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ public final void writeShortstr(String str)
5959 throws IOException
6060 {
6161 byte [] bytes = str .getBytes ("utf-8" );
62+ int length = bytes .length ;
63+ if (length > 255 ) {
64+ throw new IllegalArgumentException (
65+ "Short string too long; utf-8 encoded length = " + length +
66+ ", max = 255." );
67+ }
6268 out .writeByte (bytes .length );
6369 out .write (bytes );
6470 }
@@ -91,7 +97,7 @@ public final void writeShort(int s)
9197 public final void writeLong (int l )
9298 throws IOException
9399 {
94- // java's arithmetic on this type is signed, however its
100+ // java's arithmetic on this type is signed, however it's
95101 // reasonable to use ints to represent the unsigned long
96102 // type - for values < Integer.MAX_VALUE everything works
97103 // as expected
You can’t perform that action at this time.
0 commit comments