bsp: renesas: Fix RA pin name digit checks

Validate the second and third digits of RA PXXX pin names against their own characters. The previous checks used name[1] for those upper bounds, so non-digit suffixes could pass validation.

Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
This commit is contained in:
Old-Ding
2026-07-06 13:03:28 +08:00
committed by Rbb666
parent 5882e6a127
commit 31e634376f
@@ -374,8 +374,8 @@ static rt_base_t ra_pin_get(const char *name)
if ((rt_strlen(name) == 4) &&
(name[0] == 'P' || name[0] == 'p') &&
(name[1] >= '0' && name[1] <= '9') &&
(name[2] >= '0' && name[1] <= '9') &&
(name[3] >= '0' && name[1] <= '9'))
(name[2] >= '0' && name[2] <= '9') &&
(name[3] >= '0' && name[3] <= '9'))
{
return (name[1] - '0') * 0x100 + (name[2] - '0') * 10 + (name[3] - '0');
}