We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9675a1e commit 4ae548eCopy full SHA for 4ae548e
src/types.rs
@@ -1110,6 +1110,10 @@ impl TryFrom<&[u8]> for PtpMessage {
1110
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
1111
let header = PtpHeader::try_from(&data[..34])?;
1112
1113
+ if header.version != PtpVersion::V2 {
1114
+ return Err(anyhow::anyhow!("Unsupported PTP version"));
1115
+ }
1116
+
1117
match header.message_type {
1118
PtpMessageType::Announce => Ok(PtpMessage::Announce(AnnounceMessage::try_from(data)?)),
1119
PtpMessageType::DelayReq => Ok(PtpMessage::DelayReq(DelayReqMessage::try_from(data)?)),
0 commit comments