@@ -108,7 +108,7 @@ static ProxyProtocolData handleV1Protocol(PushbackInputStream inputStream) throw
108
108
109
109
// protocol and family
110
110
n = readUntil (inputStream , buffer , (byte ) ' ' , (byte ) '\r' );
111
- String familyProtocol = new String (buffer , 0 , n );
111
+ String familyProtocol = new String (buffer , 0 , n , StandardCharsets . US_ASCII );
112
112
var family = Family .fromString (familyProtocol );
113
113
var protocol = Protocol .fromString (familyProtocol );
114
114
byte b = readNext (inputStream );
@@ -124,22 +124,22 @@ static ProxyProtocolData handleV1Protocol(PushbackInputStream inputStream) throw
124
124
125
125
// source address
126
126
n = readUntil (inputStream , buffer , (byte ) ' ' );
127
- var sourceAddress = new String (buffer , 0 , n );
127
+ var sourceAddress = new String (buffer , 0 , n , StandardCharsets . US_ASCII );
128
128
match (inputStream , (byte ) ' ' );
129
129
130
130
// destination address
131
131
n = readUntil (inputStream , buffer , (byte ) ' ' );
132
- var destAddress = new String (buffer , 0 , n );
132
+ var destAddress = new String (buffer , 0 , n , StandardCharsets . US_ASCII );
133
133
match (inputStream , (byte ) ' ' );
134
134
135
135
// source port
136
136
n = readUntil (inputStream , buffer , (byte ) ' ' );
137
- int sourcePort = Integer .parseInt (new String (buffer , 0 , n ));
137
+ int sourcePort = Integer .parseInt (new String (buffer , 0 , n , StandardCharsets . US_ASCII ));
138
138
match (inputStream , (byte ) ' ' );
139
139
140
140
// destination port
141
141
n = readUntil (inputStream , buffer , (byte ) '\r' );
142
- int destPort = Integer .parseInt (new String (buffer , 0 , n ));
142
+ int destPort = Integer .parseInt (new String (buffer , 0 , n , StandardCharsets . US_ASCII ));
143
143
match (inputStream , (byte ) '\r' );
144
144
match (inputStream , (byte ) '\n' );
145
145
0 commit comments