svn commit: r275396 - head/lib/libgpio

Rui Paulo rpaulo at FreeBSD.org
Tue Dec 2 06:24:46 UTC 2014


Author: rpaulo
Date: Tue Dec  2 06:24:45 2014
New Revision: 275396
URL: https://svnweb.freebsd.org/changeset/base/275396

Log:
  Fix an off-by-one in gpio_pin_list().
  
  Coverity CID:	1256495

Modified:
  head/lib/libgpio/gpio.c

Modified: head/lib/libgpio/gpio.c
==============================================================================
--- head/lib/libgpio/gpio.c	Tue Dec  2 06:11:32 2014	(r275395)
+++ head/lib/libgpio/gpio.c	Tue Dec  2 06:24:45 2014	(r275396)
@@ -89,7 +89,7 @@ gpio_pin_list(gpio_handle_t handle, gpio
 		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++) {


More information about the svn-src-head mailing list