Skip to content

Commit 9a4ad4a

Browse files
committed
Use to_ascii_lowercase when checking for lnurl override start
When calling `instructions.to_lowercase().rfind("lnurl")` and then using the resulting value as a slice index in `instructions`, we implicitly assume that any unicode lowercasing will not change the length of any characters. That's probably fine in practice, but it seems like a weird assumption to make, so instead we swap it for `to_ascii_lowercase`.
1 parent d6ef87c commit 9a4ad4a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ impl PaymentInstructions {
947947
))
948948
},
949949
}
950-
} else if let Some(idx) = instructions.to_lowercase().rfind("lnurl") {
950+
} else if let Some(idx) = instructions.to_ascii_lowercase().rfind("lnurl") {
951951
let mut lnurl_str = &instructions[idx..];
952952
// first try to decode as a bech32-encoded lnurl, if that fails, try to drop a
953953
// trailing `&` and decode again, this could a http query param

0 commit comments

Comments
 (0)