Private
Public Access
2
0

stability: replace sprintf with snprintf to avoid potential overflows

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
This commit is contained in:
Alex Tereschenko
2017-05-13 18:08:00 +02:00
parent 918e2b18e2
commit 0654183b9a
5 changed files with 7 additions and 7 deletions

View File

@@ -248,7 +248,7 @@ mraa_gpio_interrupt_handler(void* arg)
} else {
// open gpio value with open(3)
char bu[MAX_SIZE];
sprintf(bu, SYSFS_CLASS_GPIO "/gpio%d/value", dev->pin);
snprintf(bu, MAX_SIZE, SYSFS_CLASS_GPIO "/gpio%d/value", dev->pin);
fp = open(bu, O_RDONLY);
if (fp < 0) {
syslog(LOG_ERR, "gpio%i: interrupt_handler: failed to open 'value' : %s", dev->pin, strerror(errno));