Skip to content

Commit 769eea3

Browse files
committed
Bug fix: when msg.len < rule.len
1 parent 5290e58 commit 769eea3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

oneport/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ async fn serv(mut visitor: TcpStream, addr: SocketAddr) {
120120
let rules = RULES.lock().await;
121121
let mut address = None;
122122
for (rule, target) in rules.as_slice() {
123-
if rule == &msg[..rule.len()] {
123+
if rule.len() <= msg.len() && rule == &msg[..rule.len()] {
124124
i!("Request {addr} matched: {target}");
125125
address = Some(target.clone());
126126
break;

0 commit comments

Comments
 (0)