DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] trace: fix build with gcc 10
@ 2020-04-27 16:47 Phil Yang
  2020-04-27 16:58 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Phil Yang @ 2020-04-27 16:47 UTC (permalink / raw)
  To: jerinj, skori, dev; +Cc: david.marchand, lijian.zhang, ruifeng.wang, nd

GCC 10 compiling output:
eal_common_trace_utils.c: In function 'eal_trace_dir_args_save':
eal_common_trace_utils.c:290:24: error: '__builtin___sprintf_chk'   \
	may write a terminating nul past the end of the destination \
	[-Werror=format-overflow=]
  290 |  sprintf(dir_path, "%s/", optarg);
      |                        ^

Fixes: 8af866df8d8c ("trace: add trace directory configuration parameter")

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Lijian Zhang <lijian.zhang@arm.com>
Tested-by: Lijian Zhang <lijian.zhang@arm.com>
---
 lib/librte_eal/common/eal_common_trace_utils.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_trace_utils.c b/lib/librte_eal/common/eal_common_trace_utils.c
index fce8892..c079642 100644
--- a/lib/librte_eal/common/eal_common_trace_utils.c
+++ b/lib/librte_eal/common/eal_common_trace_utils.c
@@ -276,7 +276,10 @@ eal_trace_dir_args_save(char const *optarg)
 		return -EINVAL;
 	}
 
-	if (strlen(optarg) >= size) {
+	/* the specified trace directory name cannot
+	 * exceed PATH_MAX-1.
+	 */
+	if (strlen(optarg) >= (size - 1)) {
 		trace_err("input string is too big");
 		return -ENAMETOOLONG;
 	}
-- 
2.7.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-04-30 13:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 16:47 [dpdk-dev] [PATCH] trace: fix build with gcc 10 Phil Yang
2020-04-27 16:58 ` Stephen Hemminger
2020-04-28  7:15   ` Phil Yang
2020-04-28  3:48 ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-04-28  7:00   ` Phil Yang
2020-04-28 10:52     ` Sunil Kumar Kori
2020-04-28 13:50       ` Phil Yang
2020-04-28 14:37 ` [dpdk-dev] [PATCH v2] " Phil Yang
2020-04-30 13:51   ` [dpdk-dev] [EXT] " Sunil Kumar Kori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).