Skip to content

Commit 31e6343

Browse files
Old-DingRbb666
authored andcommitted
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>
1 parent 5882e6a commit 31e6343

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • bsp/renesas/libraries/HAL_Drivers/drivers

bsp/renesas/libraries/HAL_Drivers/drivers/drv_gpio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ static rt_base_t ra_pin_get(const char *name)
374374
if ((rt_strlen(name) == 4) &&
375375
(name[0] == 'P' || name[0] == 'p') &&
376376
(name[1] >= '0' && name[1] <= '9') &&
377-
(name[2] >= '0' && name[1] <= '9') &&
378-
(name[3] >= '0' && name[1] <= '9'))
377+
(name[2] >= '0' && name[2] <= '9') &&
378+
(name[3] >= '0' && name[3] <= '9'))
379379
{
380380
return (name[1] - '0') * 0x100 + (name[2] - '0') * 10 + (name[3] - '0');
381381
}

0 commit comments

Comments
 (0)