meta-starlingx/meta-stx-flock/stx-metal/files/0001-mtce-avoid-overflowing-amon.tx_buf.patch
Saul Wold 467e56bfdc Restructure STX Flock recipes
Create a new layer to manage the StarlingX Flock specific recipes

Signed-off-by: Saul Wold <sgw@linux.intel.com>
2020-05-17 16:00:29 -07:00

27 lines
885 B
Diff

From 3060369f60b2dc9e6d138cabd18d7f206c7bb0f5 Mon Sep 17 00:00:00 2001
From: babak sarashki <babak.sarashki@windriver.com>
Date: Thu, 27 Jun 2019 21:40:34 -0700
Subject: [PATCH] Use snprintf to avoid overflowing amon.tx_buf
---
public/amon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/public/amon.c b/public/amon.c
index b9146a2..941f905 100644
--- a/public/amon.c
+++ b/public/amon.c
@@ -257,7 +257,8 @@ int active_monitor_dispatch ( void )
}
memset ( amon.tx_buf, 0 , AMON_MAX_LEN );
- sprintf( amon.tx_buf, "%s %8x %d%c", str, magic, seq, '\0' );
+ if (snprintf( amon.tx_buf, AMON_MAX_LEN, "%s %8x %d%c", str, magic, seq, '\0' ) < 0)
+ fprintf(stderr,"%s:%d amon.txbuf overflow detected!\n", __func__, __LINE__);
if ( strcmp ( str, amon.name ) )
{
--
2.17.1