net: lwip: fix mDNS test buffer fill size#11574
Conversation
Fill the mDNS domain name buffers with their array size instead of the size of the MDNS_DOMAIN_MAXLEN constant. This preserves the test intent of leaving different trailing bytes after equal names are encoded. Generated-by: OpenAI Codex Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-07-06 11:25 CST)
📝 Review Instructions
|
Summary
namearray sizeRoot cause
MDNS_DOMAIN_MAXLENis an integer constant, sosizeof(MDNS_DOMAIN_MAXLEN)only covers the size of that constant. Thedomain_eq_lengthtest is intended to leave different trailing bytes after equal names are encoded, so it should initialize the wholenamearray.Testing
git diff --check HEAD~1 HEADgit show --stat --check --format=fuller HEADrg -n sizeof\(MDNS_DOMAIN_MAXLEN\)|sizeof\(domain[12]\.name\) components/net/lwip/lwip-2.0.3/test/unit/mdns/test_mdns.c components/net/lwip/lwip-2.1.2/test/unit/mdns/test_mdns.cNot run locally:
scons,make,gcc,arm-none-eabi-gcc, andclangare not installed