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