From 660f8ec6a84315a75327458934d01276dd9d5ab9 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Wed, 18 Sep 2019 13:10:34 -0500 Subject: Update loragw_spi.native.c Bugfix: strncpy use size of destination Change spi_dev_path to char array --- libloragw/src/loragw_spi.native.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libloragw/src') diff --git a/libloragw/src/loragw_spi.native.c b/libloragw/src/loragw_spi.native.c index 56c9d94..4720603 100644 --- a/libloragw/src/loragw_spi.native.c +++ b/libloragw/src/loragw_spi.native.c @@ -56,7 +56,7 @@ Maintainer: Sylvain Miermont #define SPI_SPEED 8000000 #define SPI_DEV_PATH "/dev/spidev0.0" //#define SPI_DEV_PATH "/dev/spidev32766.0" -char* spi_dev_path = SPI_DEV_PATH; +char spi_dev_path[60] = SPI_DEV_PATH; /* -------------------------------------------------------------------------- */ /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ @@ -64,7 +64,7 @@ char* spi_dev_path = SPI_DEV_PATH; /* set SPI device */ int lgw_spi_set_path(const char *path) { if (path) { - strncpy(spi_dev_path, path, sizeof(path)-1); + strncpy(spi_dev_path, path, sizeof(spi_dev_path)-1); return LGW_SPI_SUCCESS; } else { -- cgit v1.2.3