[Tftp] Add ntohs() to the pack->info.block then get the right block number - #112
[Tftp] Add ntohs() to the pack->info.block then get the right block number#112lvtaolong wants to merge 2 commits into
Conversation
to get the correct block number in received network package, there need to use ntohs(pack->info.block)
Add ntohs() to the pack->info.block then get the right block number
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe TFTP data reader now converts the received block number from network byte order before comparing it with the expected block and printing the mismatch error. No other control flow or error handling changes. ChangesTFTP block validation
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~3 minutes Merge Risk: ⚪ Minimal · up to This change correctly normalizes received TFTP block numbers before validation, with no remaining merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
In tftp_read_data(struct tftp_xfer *xfer, struct tftp_packet *pack, int len) , to check the block number whether is expected here:
else if ((_private->block + 1) != pack->info.block)
but because the pack->info.block is from network package, so to get the right block number , there need to use ntohs(pack->info.block)
Summary by CodeRabbit