Skip to contentSkip to conversation

lmbench: Fix compilation error of gcc format-security

PATCH New [email protected] 1 participant 1 message Jul 19, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 lmbench: Fix compilation error of gcc format-security

From: He Zhe <[email protected]>

oe-core "security_flags: turn potential string format security issues into an error" adds "-Wformat -Wformat-security -Werror=format-security" to the default SECURITY_CFLAGS, which may cause lmbench compilation failure.

This patch fixes lmbench's code.

---
 ...ttp-Use-puts-instead-of-printf-to-avoid-f.patch | 26 ++++++++++++++++++++++
 .../recipes-benchmark/lmbench/lmbench_3.0-a9.bb    |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 meta-oe/recipes-benchmark/lmbench/lmbench/lat_http-Use-puts-instead-of-printf-to-avoid-f.patch
meta-oe/recipes-benchmark/lmbench/lmbench/lat_http-Use-puts-instead-of-printf-to-avoid-f.patch new file +26 -0
new file mode 100644
index 0000000..48613ef
@@ -0,0 +1,26 @@
+[PATCH] lat_http: Use puts instead of printf to avoid gcc
+format-security error
+
+Upstream-Status: Pending
+
+Signed-off-by: He Zhe <[email protected]>
+---
+ src/lat_http.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lat_http.c b/src/lat_http.c
+index c630d59..42e64a1 100644
+--- a/src/lat_http.c
++++ b/src/lat_http.c
+@@ -27,7 +27,7 @@ http(char *server, char *file, int prog)
+ 	sock = tcp_connect(server, prog, SOCKOPT_REUSE);
+ 	sprintf(buf, "GET /%s HTTP/1.0\r\n\r\n\n", file);
+ 	if (debug) {
+-		printf(buf);
++		printf("%s", buf);
+ 	}
+ 	write(sock, buf, strlen(buf));
+ 	while ((n = read(sock, buf, XFERSIZE)) > 0) {
+-- 
+2.8.2
+
meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb +1 -0
index 24cd0b0..b5edaeb 100644
@@ -18,6 +18,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
            file://use-base_libdir-instead-of-hardcoded-lib.patch \
            file://lmbench_result_html_report.patch \
            file://fix-lmbench-memory-check-failure.patch \
+           file://lat_http-Use-puts-instead-of-printf-to-avoid-f.patch \
 "
 SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
 SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"
Signature · 1 line
2.8.1