From c0b9f1e13fb0ac129717a42c4550b7bf3e193ce8 Mon Sep 17 00:00:00 2001 From: Mingjie Shen Date: Fri, 31 Mar 2023 19:51:16 -0400 Subject: [PATCH] demos: Fix unbounded write in sscanf call (#1859) Buffer write operations that do not control the length of data written may overflow. --- demos/defender/defender_demo_json/metrics_collector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/defender/defender_demo_json/metrics_collector.c b/demos/defender/defender_demo_json/metrics_collector.c index d08aed17a7..3af9f4305a 100644 --- a/demos/defender/defender_demo_json/metrics_collector.c +++ b/demos/defender/defender_demo_json/metrics_collector.c @@ -612,7 +612,7 @@ MetricsCollectorStatus_t GetNetworkInferfaceInfo( char ( *pOutNetworkInterfaceNa LogDebug( ( "File: /proc/net/arp, Content: %s.", &( lineBuffer[ 0 ] ) ) ); filledVariables = sscanf( lineBuffer, - "%u.%u.%u.%u %*s %*s %*s %*s %s", + "%u.%u.%u.%u %*s %*s %*s %*s %15s", &ipPart1, &ipPart2, &ipPart3,