Fix an off-by-one in gpio_pin_list().

Coverity CID:	1256495
This commit is contained in:
Rui Paulo 2014-12-02 06:24:45 +00:00
parent 244c371d25
commit e852010c39
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=275396

View File

@ -89,7 +89,7 @@ gpio_pin_list(gpio_handle_t handle, gpio_config_t **pcfgs)
errno = EINVAL;
return (-1);
}
cfgs = calloc(maxpins, sizeof(*cfgs));
cfgs = calloc(maxpins + 1, sizeof(*cfgs));
if (cfgs == NULL)
return (-1);
for (i = 0; i <= maxpins; i++) {