mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-19 03:48:04 +00:00
fix: use fixed-size slices for protocol data parsing
- Improve borsh deserialization safety across all protocol decoders - Add MarketState support for raydium_amm_v4 - Prevent buffer overflow in data decoding operations
This commit is contained in:
@@ -28,7 +28,7 @@ pub fn bonding_curve_decode(data: &[u8]) -> Option<BondingCurve> {
|
||||
if data.len() < BONDING_CURVE_SIZE {
|
||||
return None;
|
||||
}
|
||||
borsh::from_slice::<BondingCurve>(&data).ok()
|
||||
borsh::from_slice::<BondingCurve>(&data[..BONDING_CURVE_SIZE]).ok()
|
||||
}
|
||||
|
||||
pub fn bonding_curve_parser(
|
||||
@@ -75,7 +75,7 @@ pub fn global_decode(data: &[u8]) -> Option<Global> {
|
||||
if data.len() < GLOBAL_SIZE {
|
||||
return None;
|
||||
}
|
||||
borsh::from_slice::<Global>(&data).ok()
|
||||
borsh::from_slice::<Global>(&data[..GLOBAL_SIZE]).ok()
|
||||
}
|
||||
|
||||
pub fn global_parser(
|
||||
|
||||
Reference in New Issue
Block a user