stability: replace sprintf with snprintf to avoid potential overflows
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user