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

Coverity CID:	1256495
This commit is contained in:
rpaulo 2014-12-02 06:24:45 +00:00
parent e370d19845
commit af3ff681e3

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++) {