mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 14:17:47 +00:00
Spi-hdlc-adapter: Copy the spi path name before passing to syslog() (#1135)
This commit makes a change in `spi-hdlc-adapter` to copy the passed in spi path (from the argv) in a max 64 char array before passing it to `syslog()`. This ensures `syslog()` string argument has a limited size.
This commit is contained in:
committed by
Jonathan Hui
parent
42e9acb174
commit
0bc5c8e85f
@@ -1478,7 +1478,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (!setup_spi_dev(argv[0]))
|
||||
{
|
||||
syslog(LOG_ERR, "%s: Unable to open SPI device \"%s\", %s", prog, argv[0], strerror(errno));
|
||||
char spi_path[64];
|
||||
|
||||
strncpy(spi_path, argv[0], sizeof(spi_path) - 1);
|
||||
spi_path[sizeof(spi_path) - 1] = 0;
|
||||
syslog(LOG_ERR, "%s: Unable to open SPI device \"%s\", %s", prog, spi_path, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
argc--;
|
||||
|
||||
Reference in New Issue
Block a user