xyzModem: Correct xmodem blk verification conditions
PATCH 1/1 xyzModem: Correct xmodem blk verification conditions
When the blk sequence number is 255 and cblk is 0, the original XOR condition produces a result of 0,and the judgment condition will be unsuccessful.
--- common/xyzModem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/xyzModem.c +1 -1
@@ -373,7 +373,7 @@ xyzModem_get_hdr (void) }ZM_DEBUG (zm_dump (__LINE__));/* Validate the message */ -if ((xyz.blk ^ xyz.cblk) != (unsigned char )0xFF ) +if (~xyz.blk != xyz.cblk) { ZM_DEBUG (zm_dprintf ("Framing error - blk: %x/%x/%x\n", xyz.blk, xyz.cblk,
Signature · 1 line
2.34.1
Quoted 13 lines · Hongbin Ji
When the blk sequence number is 255 and cblk is 0, the original XOR condition produces a result of 0,and the judgment condition will be unsuccessful.
Signed-off-by Hongbin Ji <[email protected]>--- common/xyzModem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/xyzModem.c +0
-0
common/xyzModem.c xyzModem_get_hdr (void) · line 379
Quoted 8 lines
common/xyzModem.c +1
-1@@ -373,7 +373,7 @@ xyzModem_get_hdr (void) }ZM_DEBUG (zm_dump (__LINE__));/* Validate the message */ -if ((xyz.blk ^ xyz.cblk) != (unsigned char )0xFF ) +if (~xyz.blk != xyz.cblk) { ZM_DEBUG (zm_dprintf ("Framing error - blk: %x/%x/%x\n", xyz.blk, xyz.cblk,
As Dan noted before, this is very old code. Is there a problem you're encountering in the real world? What has brought you to see a problem and make a change here? Thanks.
Signature · 1 line
Tom
This is a duplicate, please ignore
Quoted 21 lines · Hongbin Ji
When the blk sequence number is 255 and cblk is 0, the original XOR condition produces a result of 0,and the judgment condition will be unsuccessful.
Signed-off-by Hongbin Ji <[email protected]>--- common/xyzModem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/xyzModem.c +1
-1@@ -373,7 +373,7 @@ xyzModem_get_hdr (void) }ZM_DEBUG (zm_dump (__LINE__));/* Validate the message */ -if ((xyz.blk ^ xyz.cblk) != (unsigned char )0xFF ) +if (~xyz.blk != xyz.cblk) { ZM_DEBUG (zm_dprintf ("Framing error - blk: %x/%x/%x\n", xyz.blk, xyz.cblk,